Skip to content

Commit

Permalink
fix: stage selection (#744)
Browse files Browse the repository at this point in the history
Fixes #728
  • Loading branch information
IzStriker authored May 24, 2024
1 parent 4d76c8b commit eb141b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/bracket/sql/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit eb141b5

Please sign in to comment.