Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hasura/functions/tournaments/reset_tournament_match.sql
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,6 +211,7 @@ BEGIN
DELETE FROM tournament_trophies
WHERE tournament_id = source_tournament_id;
END IF;

END IF;
END;
$$;
8 changes: 5 additions & 3 deletions hasura/functions/tournaments/schedule_tournament_match.sql
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,15 +61,17 @@ CREATE OR REPLACE FUNCTION public.schedule_tournament_match(bracket public.tourn
_match_options_id := tournament.match_options_id;
END IF;

-- Enforce match_mode: skip auto-scheduling for admin-only matches
-- Enforce match_mode:
-- - admin mode requires an explicit organizer-set schedule on the bracket
-- - other modes can continue existing auto-scheduling behavior
DECLARE
_match_mode text;
BEGIN
SELECT mo.match_mode INTO _match_mode
FROM match_options mo WHERE mo.id = _match_options_id;

IF _match_mode = 'admin' THEN
RAISE NOTICE 'schedule_tournament_match: bracket % is admin-mode, skipping auto-schedule', bracket.id;
IF _match_mode = 'admin' AND bracket.scheduled_at IS NULL THEN
RAISE NOTICE 'schedule_tournament_match: bracket % is admin-mode without schedule, skipping auto-schedule', bracket.id;
RETURN NULL;
END IF;
END;
Expand Down
Loading
Loading