mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-26 21:26:01 -05:00
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.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user