Skip to content

Commit 9527ca5

Browse files
committed
bug: fix removing LB brackets when seeds were empty, and make sure to fill in all brackets
1 parent a3eff7e commit 9527ca5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

hasura/functions/tournaments/link_tournament_stage_matches.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ BEGIN
100100
DELETE FROM tournament_brackets
101101
WHERE tournament_stage_id = _stage_id
102102
AND round = 1
103-
AND (team_1_seed IS NULL OR team_2_seed IS NULL);
103+
AND (team_1_seed IS NULL OR team_2_seed IS NULL)
104+
AND path != 'LB';
104105
END;
105106

106107
END;

hasura/functions/tournaments/seed_stage.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,17 @@ BEGIN
157157
-- Elimination brackets can have byes
158158
UPDATE tournament_brackets
159159
SET tournament_team_id_1 = team_1_id,
160-
tournament_team_id_2 = team_2_id,
161-
bye = (team_1_id IS NULL OR team_2_id IS NULL)
162-
WHERE id = bracket.id and round = 1;
160+
tournament_team_id_2 = team_2_id
161+
WHERE id = bracket.id;
163162

164163
RAISE NOTICE ' Bracket %: Seed % (team %) vs Seed % (team %)',
165164
bracket.match_number,
166165
team_1_seed_val, team_1_id,
167166
team_2_seed_val, team_2_id;
168167
END LOOP;
168+
169+
update tournament_brackets set bye = (team_1_id IS NULL OR team_2_id IS NULL)
170+
where tournament_stage_id = stage.id and round = 1;
169171
END IF;
170172

171173
IF stage.type != 'RoundRobin' THEN

0 commit comments

Comments
 (0)