Skip to content

Commit

Permalink
fit: add trail run sport type under run
Browse files Browse the repository at this point in the history
Strava supports trail runs as a type under activity type Run now, so add
this so people can see how stressed our thighs.
  • Loading branch information
LeoWu343 committed May 16, 2024
1 parent 33e5983 commit a5c5f73
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 a5c5f73

Please sign in to comment.