Fix already done match showing as current match

This commit is contained in:
Kalle (Sendou) 2022-01-08 17:56:48 +02:00
parent 7586c352dd
commit ab266bbcc3

View File

@ -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) {