diff --git a/packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts b/packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts index d510453..26726c7 100644 --- a/packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts +++ b/packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts @@ -55,7 +55,7 @@ export class SeasonStandingsComponent { return; } - this.onUpdatedStandings(this.season.standings); + this.sortStandings(this.season.standings); console.log("Season Standings - Begin") console.log(this.season); console.log(this.sortedStandings); @@ -68,6 +68,15 @@ export class SeasonStandingsComponent { this.sseService.unregisterEventHandler('season-standings.updated', this.updatedStandingsListener); } + sortStandings(data:SeasonStanding[]) { + let sorted = [...data] + sorted.sort((a, b) => { + return a.points - b.points + }) + + this.sortedStandings = [...sorted]; + } + onUpdatedStandings(data: any) { if(this.season != undefined && data.seasonId != this.season.id){ return; @@ -78,11 +87,7 @@ export class SeasonStandingsComponent { sorted.push(result) } - sorted.sort((a, b) => { - return a.points - b.points - }) - - this.sortedStandings = [...sorted]; + this.sortStandings(sorted); } getRacerName(racer: any): string {