Skip to content

Commit

Permalink
fix(competitions): sort phases by order attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsandoz committed Jan 18, 2024
1 parent 31b1f0c commit b722925
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions models/competition-edition.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ export default class CompetitionEdition {
}

if (groups) {
this.phases = groups.map((group) => {
const phase = new Phase(group);
phase.rounds = this.rounds?.filter((round) => round.phase_id === phase.id);
return phase;
});
this.phases = groups
.sort((phaseA, phaseB) => phaseA.attributes.order - phaseB.attributes.order)
.map((group) => {
const phase = new Phase(group);
phase.rounds = this.rounds?.filter((round) => round.phase_id === phase.id);
return phase;
});
}
this.facilities = facilities;
this.results = results;
Expand Down

0 comments on commit b722925

Please sign in to comment.