From fd2681876e0a81871f1b6d98446a18ab250c6a6a Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 23 Nov 2023 15:43:29 +0000 Subject: [PATCH] Start of standings update --- .../season-standings.service.ts | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/packages/bridge-server/src/season-standings/season-standings.service.ts b/packages/bridge-server/src/season-standings/season-standings.service.ts index 84b4441..814884b 100644 --- a/packages/bridge-server/src/season-standings/season-standings.service.ts +++ b/packages/bridge-server/src/season-standings/season-standings.service.ts @@ -37,36 +37,12 @@ export class SeasonStandingsService { async updateStandings(seasonId: number) { let racesInSeason = await this.racesService.findManyBySeason(seasonId); console.log(racesInSeason); - // find unique racers in this season - // for each race in the season - /* - if( this.race.racers == undefined) { - console.log("No racers in race-details") - return; - } - for( let racer_id of this.race?.racers ) { - this.racersService.getRacer(racer_id).subscribe( data => { - if(data != undefined) { - this.racers.set(racer_id, data); + let seasonRacers = []; + for(let race of racesInSeason) { + for( let result of race.results ){ +// if ( ) + } } - }); - this.raceResultService.getRaceResultsForRacerInRace(racer_id, this.race.id).subscribe( data => { - if(data != undefined) { - this.raceResults.set(racer_id, data); - let result = this.getBestTimeForRacer(racer_id); - if (result != undefined) { - this.sortedResults.push(result) - this.sortedResults.sort((a, b) => { - if( a.time == b.time ) { return 0 }; - if( a.time < b.time ) { return -1}; - return 1; - }) - this.sortedResults = [...this.sortedResults]; - } - } - }); - } - */ } }