diff --git a/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts b/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts index ed7040d39..521b9d679 100644 --- a/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts +++ b/app/features/tournament-match/actions/to.$id.matches.$mid.server.ts @@ -116,6 +116,7 @@ export const action: ActionFunction = async ({ params, request }) => { let emitMatchUpdate = false; let emitTournamentUpdate = false; + let setIsOver = false; let endedDroppedMatchIds: number[] = []; switch (data._action) { @@ -245,6 +246,7 @@ export const action: ActionFunction = async ({ params, request }) => { emitMatchUpdate = true; emitTournamentUpdate = true; + setIsOver = setOver; break; } @@ -767,6 +769,7 @@ export const action: ActionFunction = async ({ params, request }) => { emitMatchUpdate = true; emitTournamentUpdate = true; + setIsOver = true; break; } @@ -815,6 +818,12 @@ export const action: ActionFunction = async ({ params, request }) => { clearTournamentDataCache(tournamentId); + // update RunningTournaments to make sure sidebar is not showing stale matches at the end + // of the tournament in case the TO is not finalizing the tournament right away + if (setIsOver) { + await tournamentFromDB({ tournamentId, user }); + } + if (emitMatchUpdate) { ChatSystemMessage.send([ {