Browse Source

Fix standings

new_auth
Dan 2 years ago
parent
commit
d5165ad451
  1. 17
      packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts

17
packages/bridge-ui/src/app/components/season-standings/season-standings.component.ts

@ -55,7 +55,7 @@ export class SeasonStandingsComponent {
return; return;
} }
this.onUpdatedStandings(this.season.standings); this.sortStandings(this.season.standings);
console.log("Season Standings - Begin") console.log("Season Standings - Begin")
console.log(this.season); console.log(this.season);
console.log(this.sortedStandings); console.log(this.sortedStandings);
@ -68,6 +68,15 @@ export class SeasonStandingsComponent {
this.sseService.unregisterEventHandler('season-standings.updated', this.updatedStandingsListener); 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) { onUpdatedStandings(data: any) {
if(this.season != undefined && data.seasonId != this.season.id){ if(this.season != undefined && data.seasonId != this.season.id){
return; return;
@ -78,11 +87,7 @@ export class SeasonStandingsComponent {
sorted.push(result) sorted.push(result)
} }
sorted.sort((a, b) => { this.sortStandings(sorted);
return a.points - b.points
})
this.sortedStandings = [...sorted];
} }
getRacerName(racer: any): string { getRacerName(racer: any): string {

Loading…
Cancel
Save