Filter out match-less sets in team set history
Some checks failed
E2E Tests / e2e (push) Has been cancelled
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled

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.
This commit is contained in:
Kalle
2026-04-28 21:20:56 +03:00
parent a1491a189e
commit bfef81682e

View File

@@ -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();