From ab266bbcc39e95bf4f48efad925b16dcd76dbc54 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Sat, 8 Jan 2022 17:56:48 +0200 Subject: [PATCH] Fix already done match showing as current match --- app/components/tournament/BracketActions.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/components/tournament/BracketActions.tsx b/app/components/tournament/BracketActions.tsx index d9e1ac3fd..5a0f387a9 100644 --- a/app/components/tournament/BracketActions.tsx +++ b/app/components/tournament/BracketActions.tsx @@ -1,5 +1,6 @@ import { useLoaderData, useMatches } from "remix"; import invariant from "tiny-invariant"; +import { matchIsOver } from "~/core/tournament/utils"; import type { BracketModified, FindTournamentByNameForUrlI, @@ -52,12 +53,11 @@ export function BracketActions() { ); const isOwnMatch = match.participants?.some((p) => p === ownTeam.name); - const higherCount = match.score - ? Math.max(match.score[0], match.score[1]) - : 0; - const isNotOver = higherCount < match.round.matches.length / 2; - - return hasBothParticipants && isOwnMatch && isNotOver; + return ( + hasBothParticipants && + isOwnMatch && + !matchIsOver(match.round.stages.length, match.score) + ); }); if (currentMatch) {