Skip to content

Commit

Permalink
fix: Quick fix for world cup
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobi2K committed Jan 15, 2025
1 parent 2673525 commit 0031ecd
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/cron/cron.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,10 @@ export class CronService {
}

async syncGames(data: any[], new_season: Season) {
this.logger.debug('Syncing games and times...');

this.logger.debug('Syncing games and times... | ' + new_season.name);
for (let i = 0; i < data.length; i++) {
const game = data[i];
// DIRTY FIX FOR WORLD CHAMPIONSHIP 2025 --> Games for World cup since 2021 are all combined into a single competition, so we split only the games after Jan. 1st 2025
if (new_season.id == 1075 && this.moment("2025-01-01") > this.moment(game.date)) {
continue
}

const new_eventID = game.id;
let new_gameday = game.week;
let new_stage = game.week;
Expand Down Expand Up @@ -503,9 +499,20 @@ export class CronService {
.toPromise()
).data.response;

await this.syncGames(data, season);

// DIRTY FIX FOR WORLD CHAMPIONSHIP 2025 --> Games for World cup since 2021 are all combined into a single competition, so we split only the games after Jan. 1st 2025
if (season.id == 1075) {
const filtered_data = data.filter((e) =>
this.moment("2025-01-01") < this.moment(e.date)
);
await this.syncGames(filtered_data, season);

this.syncPoints(data);
this.syncPoints(filtered_data);
} else {
await this.syncGames(data, season);

this.syncPoints(data);
}

await new Promise((res) => setTimeout(res, 6000));
}
Expand Down

0 comments on commit 0031ecd

Please sign in to comment.