Skip to content

Commit

Permalink
Merge pull request #208 from LeoWu343/master
Browse files Browse the repository at this point in the history
fit: add trail run sport type under run
  • Loading branch information
hellos3b authored May 16, 2024
2 parents 33e5983 + a5c5f73 commit db443f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/fitness/src/PostWorkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const ActivityType = {

const SportType = {
PICKLEBALL: "Pickleball",
TRAIL_RUN: "TrailRun",
};

// workout type of user is inputed
Expand Down Expand Up @@ -136,6 +137,8 @@ const activityText = (activity) => {
case ActivityType.RUN:
if (activity.workout_type === WorkoutType.RUN_WORKOUT)
return `did a ${elapsed} running working`;
else if (activity.sport_type === SportType.TRAIL_RUN)
return `ran ${distance} up ${elevation} in ${elapsed} (avg pace ${pace})`;
else if (distance && pace)
return `ran ${distance} in ${elapsed} (avg pace ${pace})`;
else if (distance) return `ran ${distance} in ${elapsed}`;
Expand Down Expand Up @@ -301,8 +304,8 @@ const postWorkout = (discord, db) => async (stravaId, activityId) => {
const channel = await discord.channels.fetch(process.env.CHANNEL_STRAVA);
const message = existing?.messageId
? await channel.messages
.fetch(existing.messageId)
.then((x) => x.edit({ embeds: [embed] }))
.fetch(existing.messageId)
.then((x) => x.edit({ embeds: [embed] }))
: await channel.send({ embeds: [embed] });

await loggedWorkoutCollection(db).updateOne(
Expand Down

0 comments on commit db443f8

Please sign in to comment.