|
|
|
@ -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]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|