Skip to content

Commit 5741ba5

Browse files
committed
wip
1 parent 82996e2 commit 5741ba5

6 files changed

Lines changed: 4 additions & 4 deletions

File tree

hasura/functions/tournaments/generate_swiss_bracket.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BEGIN
1919
-- In Swiss, teams play until they reach 3 wins or 3 losses
2020
-- Maximum rounds would be if teams alternate wins/losses: 6 rounds (0-0 -> 1-0 -> 1-1 -> 2-1 -> 2-2 -> 3-2 or 2-3)
2121
-- But we'll generate up to 6 rounds to be safe
22+
-- TODO - this is bad
2223
max_rounds := 6;
2324

2425
RAISE NOTICE '=== Generating Swiss Bracket for % teams ===', _team_count;

hasura/functions/tournaments/seed_stage.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ BEGIN
3131
RAISE NOTICE '--- Processing Stage % (groups: %, type: %) ---', stage."order", stage.groups, stage.type;
3232

3333
IF stage.type = 'Swiss' THEN
34+
-- TODO - i think this is the same as single / double elimination seeding
3435
-- For Swiss, assign teams to first round (round 1, pool 0-0)
3536
-- The brackets are already created by generate_swiss_bracket, just need to assign teams by seed
3637
FOR bracket IN

hasura/functions/tournaments/tournament_has_min_teams.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- TODO
12
CREATE OR REPLACE FUNCTION public.tournament_has_min_teams(tournament public.tournaments)
23
RETURNS boolean
34
LANGUAGE plpgsql STABLE

hasura/functions/tournaments/update_tournament_bracket.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,11 @@ BEGIN
5353
PERFORM advance_round_robin_teams(bracket.tournament_stage_id);
5454
END IF;
5555
ELSIF stage_type = 'Swiss' THEN
56-
-- Check if current round is complete
5756
IF check_swiss_round_complete(bracket.tournament_stage_id, bracket.round) THEN
5857
RAISE NOTICE 'Swiss round % complete, assigning teams to next round pools', bracket.round;
5958

60-
-- Advance/eliminate teams based on 3 wins/losses
6159
PERFORM advance_swiss_teams(bracket.tournament_stage_id);
6260

63-
-- Assign teams to next round pools (brackets already exist, just need to assign teams)
6461
PERFORM assign_teams_to_swiss_pools(bracket.tournament_stage_id, bracket.round + 1);
6562
END IF;
6663
END IF;

hasura/functions/tournaments/update_tournament_stages.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ BEGIN
138138
RAISE EXCEPTION 'Swiss tournament first round must have an even number of teams. Current: %', effective_teams;
139139
END IF;
140140

141-
-- Generate entire Swiss bracket with all rounds and pools
142141
PERFORM generate_swiss_bracket(stage.id, effective_teams);
143142

144143
CONTINUE;

hasura/triggers/tournament_stages.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- TODO - is this duplicated code?
12
CREATE OR REPLACE FUNCTION public.taiu_tournament_stages()
23
RETURNS TRIGGER
34
LANGUAGE plpgsql

0 commit comments

Comments
 (0)