mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Fix seasons page crash
This commit is contained in:
parent
684d3ba74c
commit
5ba85f8db2
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user