Fix standings not correct if some bracket unplayed
Some checks failed
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled

This commit is contained in:
Kalle 2024-12-17 21:07:14 +02:00
parent d3a825bd57
commit a15f754754

View File

@ -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,