From bfef81682ea82a5b2940c3a455510b302be14c0e Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:20:56 +0300 Subject: [PATCH] Filter out match-less sets in team set history Regression introduced in b26f4ab2 (Migrate setHistoryByTeamId to Kysely): the old raw SQL inner-joined through TournamentMatchGameResultParticipant, which implicitly dropped completed matches that had no game results (forfeits/walkovers). The Kysely version fetches players via a jsonArrayFrom subquery, so those matches leaked through and rendered as 0-0 on the team page. --- .../TournamentMatchRepository.server.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/features/tournament-bracket/TournamentMatchRepository.server.ts b/app/features/tournament-bracket/TournamentMatchRepository.server.ts index 050208d4f..b1928c731 100644 --- a/app/features/tournament-bracket/TournamentMatchRepository.server.ts +++ b/app/features/tournament-bracket/TournamentMatchRepository.server.ts @@ -224,6 +224,18 @@ export function findByTournamentTeamId(tournamentTeamId: number) { ]), ) .where("TournamentMatch.status", ">=", TournamentMatchStatus.Completed) + .where((eb) => + eb.exists( + eb + .selectFrom("TournamentMatchGameResult") + .select("TournamentMatchGameResult.id") + .whereRef( + "TournamentMatchGameResult.matchId", + "=", + "TournamentMatch.id", + ), + ), + ) .orderBy("TournamentGroup.number", "asc") .orderBy("TournamentRound.number", "asc") .execute();