From c4b404e7a9a72b04d1e3013d37cdc12daa7cd180 Mon Sep 17 00:00:00 2001 From: prokopparuzek Date: Tue, 28 Oct 2025 16:31:40 +0100 Subject: [PATCH] admin team ID --- admin.go | 4 ++-- templates.go | 1 + templates/adminTeams.html | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/admin.go b/admin.go index 57ff532..af5063f 100644 --- a/admin.go +++ b/admin.go @@ -122,7 +122,7 @@ func adminTeamsHandler(w http.ResponseWriter, r *http.Request) { } // Fetch all teams with their difficulty levels // Teams - rows, err := db.Query("SELECT name, difficulty_levels.level_name, last_cipher, penalty FROM teams JOIN difficulty_levels ON teams.difficulty_level = difficulty_levels.id ORDER BY teams.difficulty_level, teams.name") + rows, err := db.Query("SELECT teams.id, name, difficulty_levels.level_name, last_cipher, penalty FROM teams JOIN difficulty_levels ON teams.difficulty_level = difficulty_levels.id ORDER BY teams.difficulty_level, teams.name") if err != nil { http.Error(w, "Database error", http.StatusInternalServerError) return @@ -131,7 +131,7 @@ func adminTeamsHandler(w http.ResponseWriter, r *http.Request) { var teams []TeamTemplateS for rows.Next() { var team TeamTemplateS - if err := rows.Scan(&team.TeamName, &team.Difficulty, &team.LastCipher, &team.Penalties); err != nil { + if err := rows.Scan(&team.ID, &team.TeamName, &team.Difficulty, &team.LastCipher, &team.Penalties); err != nil { http.Error(w, "Database error", http.StatusInternalServerError) return } diff --git a/templates.go b/templates.go index c1ce156..84a8693 100644 --- a/templates.go +++ b/templates.go @@ -19,6 +19,7 @@ type CipherTemplateS struct { } type TeamTemplateS struct { + ID int TeamName string Difficulty string LastCipher int diff --git a/templates/adminTeams.html b/templates/adminTeams.html index d8963b5..894305e 100644 --- a/templates/adminTeams.html +++ b/templates/adminTeams.html @@ -10,6 +10,7 @@

Týmy

+ @@ -19,6 +20,7 @@ {{range .Teams}} +
ID Název týmu Obtížnost Poslední šifra
{{.ID}} {{.TeamName}} {{.Difficulty}} {{.LastCipher}}