Skip to content

Commit

Permalink
Fix standings not correct if some bracket unplayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc committed Dec 17, 2024
1 parent d3a825b commit a15f754
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/features/tournament/core/Standings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ export function tournamentStandings(tournament: Tournament): Standing[] {
const result: Standing[] = [];
const alreadyIncludedTeamIds = new Set<number>();

const finalBracketIsOver = tournament.brackets.some(
(bracket) => bracket.isFinals && bracket.everyMatchOver,
);

for (const bracketIdx of bracketIdxs) {
const bracket = tournament.bracketByIdx(bracketIdx);
if (!bracket) continue;
// sometimes a bracket might not be played so then we ignore it from the standings
if (finalBracketIsOver && bracket.preview) continue;

const standings = standingsToMergeable({
alreadyIncludedTeamIds,
Expand Down

0 comments on commit a15f754

Please sign in to comment.