From a15f7547547edf74228e8825c709e2a279cb6e06 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:07:14 +0200 Subject: [PATCH] Fix standings not correct if some bracket unplayed --- app/features/tournament/core/Standings.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/features/tournament/core/Standings.ts b/app/features/tournament/core/Standings.ts index 5031d2e00..99230636f 100644 --- a/app/features/tournament/core/Standings.ts +++ b/app/features/tournament/core/Standings.ts @@ -91,9 +91,15 @@ export function tournamentStandings(tournament: Tournament): Standing[] { const result: Standing[] = []; const alreadyIncludedTeamIds = new Set(); + 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,