Fix seasons page crash
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle 2025-07-06 14:35:58 +03:00
parent 684d3ba74c
commit 5ba85f8db2
2 changed files with 18 additions and 0 deletions

View File

@ -237,6 +237,12 @@ export async function seasonsParticipatedInByUserId(userId: number) {
.selectFrom("Skill")
.select("season")
.where("userId", "=", userId)
.where(({ or, eb }) =>
or([
eb("groupMatchId", "is not", null),
eb("tournamentId", "is not", null),
]),
)
.groupBy("season")
.orderBy("season", "desc")
.execute();

View File

@ -204,6 +204,12 @@ export async function seasonResultPagesByUserId({
.select(({ fn }) => [fn.countAll().as("count")])
.where("userId", "=", userId)
.where("season", "=", season)
.where(({ or, eb }) =>
or([
eb("groupMatchId", "is not", null),
eb("tournamentId", "is not", null),
]),
)
.executeTakeFirstOrThrow();
return Math.ceil((row.count as number) / MATCHES_PER_SEASONS_PAGE);
@ -327,6 +333,12 @@ export async function seasonResultsByUserId({
])
.where("userId", "=", userId)
.where("season", "=", season)
.where(({ or, eb }) =>
or([
eb("groupMatchId", "is not", null),
eb("tournamentId", "is not", null),
]),
)
.limit(MATCHES_PER_SEASONS_PAGE)
.offset(MATCHES_PER_SEASONS_PAGE * (page - 1))
.orderBy("Skill.id", "desc")