Handle special case where tournament was started early

This commit is contained in:
Kalle 2023-12-03 11:15:55 +02:00
parent 11f9e80b43
commit 58727249e4

View File

@ -79,7 +79,11 @@ export const loader = async ({ params, request }: LoaderArgs) => {
const hasStarted = hasTournamentStarted(tournamentId);
let teams = findTeamsByTournamentId(tournamentId);
if (hasStarted) {
teams = teams.filter(teamHasCheckedIn);
const checkedInTeams = teams.filter(teamHasCheckedIn);
// handle special case where tournament was started early
if (checkedInTeams.length > 0) {
teams = checkedInTeams;
}
}
const teamMemberOfName = teams.find((team) =>