Skip to content

Commit

Permalink
fit: temp disable inactive check
Browse files Browse the repository at this point in the history
  • Loading branch information
hellos3b committed Oct 21, 2023
1 parent b604991 commit d4f31dd
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions bot/src/commands/fit/WorkoutEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,10 @@ export const expSoFar = (workout: Workout.workout, workouts: Workout.workout[]):

// We won't post workouts from users who have gone inactive.
const inactive = (user: User.authorized) => {
// starting this, we'll filter out feedback after x days
const featStart = new Date("2023-10-21T00:04:53.555Z");
if (!isAfter(new Date(), featStart)) return false;

const lastActive = new Date(user.lastActive || 0);
const limit = subDays(new Date(), 14);
return isAfter(lastActive, limit);
}
const lastActive = new Date (user.lastActive || 0);
const limit = subDays (new Date (), 14);
return isAfter (lastActive, limit);
};

// When a new workout gets recorded we post it to the #strava channel with these steps:
//
Expand All @@ -155,10 +151,11 @@ export const post = async (
return new Error ("Could not post workout: User is not authorized (strava ID: " + stravaId + ")");
}

if (inactive(user)) {
log.debug("User has not posted in a while", { lastActive: user.lastActive });
return new Error ("User has not posted recently");
}
// todo: enable after a week or so
// if (inactive (user)) {
// log.debug ("User has not posted in a while", { lastActive: user.lastActive });
// return new Error ("User has not posted recently");
// }

const member = await Guild.member (user.discordId, client);
if (!member) {
Expand Down

0 comments on commit d4f31dd

Please sign in to comment.