From 9f9efc2bc07810d2e06b37bad94e5922681eadef Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 18 Feb 2026 22:38:15 +0900 Subject: feat: refactor tournament to generic DB-backed N-person bracket Replace hardcoded 6-person tournament with a generic single-elimination bracket system backed by new DB tables (tournaments, tournament_entries, tournament_matches). Includes admin CRUD, standard seeding algorithm, bye handling, and a CSS Grid bracket renderer on the frontend. Add comprehensive tests for backend API/admin handlers, seeding logic, and frontend bracket component. Co-Authored-By: Claude Opus 4.6 --- backend/admin/templates/dashboard.html | 3 ++ backend/admin/templates/tournament_edit.html | 48 ++++++++++++++++++++++++++++ backend/admin/templates/tournament_new.html | 22 +++++++++++++ backend/admin/templates/tournaments.html | 20 ++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 backend/admin/templates/tournament_edit.html create mode 100644 backend/admin/templates/tournament_new.html create mode 100644 backend/admin/templates/tournaments.html (limited to 'backend/admin/templates') diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html index 5a7b484..2e9336a 100644 --- a/backend/admin/templates/dashboard.html +++ b/backend/admin/templates/dashboard.html @@ -10,6 +10,9 @@

Problems

+

+ Tournaments +

Online Qualifying Ranking

diff --git a/backend/admin/templates/tournament_edit.html b/backend/admin/templates/tournament_edit.html new file mode 100644 index 0000000..6c1ad6c --- /dev/null +++ b/backend/admin/templates/tournament_edit.html @@ -0,0 +1,48 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +Dashboard | Tournaments +{{ end }} + +{{ define "content" }} +
+
+ + +
+ +

Bracket (size={{ .Tournament.BracketSize }}, rounds={{ .Tournament.NumRounds }})

+ +

Entries (seed → user)

+ {{ range .Seeds }} + {{ $seed := . }} +
+ + +
+ {{ end }} + +

Matches (game assignment)

+ {{ range .Matches }} +
+ + {{ $matchID := .MatchID }} + +
+ {{ end }} + +
+ +
+
+{{ end }} diff --git a/backend/admin/templates/tournament_new.html b/backend/admin/templates/tournament_new.html new file mode 100644 index 0000000..14b0c4c --- /dev/null +++ b/backend/admin/templates/tournament_new.html @@ -0,0 +1,22 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +Dashboard | Tournaments +{{ end }} + +{{ define "content" }} +
+
+ + +
+
+ + + Bracket size will be rounded up to next power of 2. +
+
+ +
+
+{{ end }} diff --git a/backend/admin/templates/tournaments.html b/backend/admin/templates/tournaments.html new file mode 100644 index 0000000..09989a2 --- /dev/null +++ b/backend/admin/templates/tournaments.html @@ -0,0 +1,20 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +Dashboard +{{ end }} + +{{ define "content" }} +
+ Create New Tournament +
+ +{{ end }} -- cgit v1.3.1