From 803b93e061a2f7868913358ea7f95be6570f91d6 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:20:45 +0300 Subject: [PATCH] Fix DE round labels Closes #1877 --- app/features/tournament-bracket/core/rounds.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/features/tournament-bracket/core/rounds.ts b/app/features/tournament-bracket/core/rounds.ts index aeccaf305..506848a6f 100644 --- a/app/features/tournament-bracket/core/rounds.ts +++ b/app/features/tournament-bracket/core/rounds.ts @@ -76,11 +76,19 @@ export function getRounds(args: { const namePrefix = args.type === "winners" ? "WB " : args.type === "losers" ? "LB " : ""; - const isFinals = i === rounds.length - (args.type === "winners" ? 3 : 1); + const finalsOffSet = () => { + if (args.type !== "winners") return 1; + if (showingBracketReset) return 3; + return 2; + }; + const isFinals = i === rounds.length - finalsOffSet(); - const semisOffSet = - args.type === "winners" ? 4 : hasThirdPlaceMatch ? 3 : 2; - const isSemis = i === rounds.length - semisOffSet; + const semisOffSet = () => { + if (args.type !== "winners") return hasThirdPlaceMatch ? 3 : 2; + if (showingBracketReset) return 4; + return 3; + }; + const isSemis = i === rounds.length - semisOffSet(); return `${namePrefix}${ isFinals ? "Finals" : isSemis ? "Semis" : `Round ${i + 1}`