fix: stage selection (#744)

Fixes #728
This commit is contained in:
IzStriker
2024-05-24 16:45:10 +01:00
committed by GitHub
parent 4d76c8bb17
commit eb141b59b5

View File

@@ -158,7 +158,7 @@ async def get_next_stage_in_tournament(
THEN (
id > COALESCE(
(
SELECT id FROM stages AS t
SELECT id FROM stages
WHERE is_active IS TRUE
AND stages.tournament_id = :tournament_id
ORDER BY id ASC
@@ -170,7 +170,7 @@ async def get_next_stage_in_tournament(
ELSE (
id < COALESCE(
(
SELECT id FROM stages AS t
SELECT id FROM stages
WHERE is_active IS TRUE
AND stages.tournament_id = :tournament_id
ORDER BY id DESC
@@ -182,6 +182,9 @@ async def get_next_stage_in_tournament(
END
AND stages.tournament_id = :tournament_id
AND is_active IS FALSE
ORDER BY
CASE WHEN :direction='next' THEN id END ASC,
CASE WHEN NOT :direction='next' THEN id END DESC
"""
return cast(
StageId | None,