Skip to content

Commit

Permalink
fix test steps
Browse files Browse the repository at this point in the history
Fix test steps `getLatestSeason`, `listSeasons , and `getSeason`.
  • Loading branch information
EthanThatOneKid committed Oct 12, 2023
1 parent 53a90d6 commit 58bff1e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/leaderboard/denokv/denokv_leaderboard_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,17 @@ export class DenoKvLeaderboardClient implements LeaderboardClient {
const players = await this.listPlayers();
season = await sync({ lcClient: this.lc, players, season });

// Store the synced season.
await this.kv.set(
[LeaderboardKvPrefix.SEASONS, season.id],
season,
);

// Update the season if it is the latest season.
const startOfWeekDate = new Date(startOfWeekUTC);
const seasonStartDate = new Date(season.start_date);
const isLatestSeason =
new Date(startOfWeekUTC) === new Date(season.start_date);
startOfWeekDate.getTime() === seasonStartDate.getTime();
if (isLatestSeason) {
await this.updateLatestSeason(season, seasonResult);
}
Expand Down

0 comments on commit 58bff1e

Please sign in to comment.