diff --git a/static/js/match_play.js b/static/js/match_play.js index e933c1879..8044ac63d 100644 --- a/static/js/match_play.js +++ b/static/js/match_play.js @@ -120,8 +120,10 @@ const setTestMatchName = function () { // Returns the integer team number entered into the team number input box for the given station, or 0 if it is empty. const getTeamNumber = function (station) { - const teamId = $(`#status${station} .team-number`).val().trim(); - return teamId ? parseInt(teamId) : 0; + const raw = $(`#status${station} .team-number`).val().trim(); + if (!raw) return 0; + const num = parseInt(raw); + return isNaN(num) ? 0 : num; } // Handles a websocket message to update the team connection status. diff --git a/templates/match_play.html b/templates/match_play.html index 0887f137c..5a6399ba3 100644 --- a/templates/match_play.html +++ b/templates/match_play.html @@ -242,6 +242,11 @@ + + {{range .Teams}} + + {{end}} + {{end}} {{define "script"}} @@ -251,7 +256,8 @@
{{.position}}
-
diff --git a/web/match_play.go b/web/match_play.go index 6476c542d..68ab42378 100644 --- a/web/match_play.go +++ b/web/match_play.go @@ -44,14 +44,21 @@ func (web *Web) matchPlayHandler(w http.ResponseWriter, r *http.Request) { handleWebErr(w, err) return } + teams, err := web.arena.Database.GetAllTeams() + if err != nil { + handleWebErr(w, err) + return + } data := struct { *model.EventSettings PlcIsEnabled bool PlcArmorBlockStatuses map[string]bool + Teams []model.Team }{ web.arena.EventSettings, web.arena.Plc.IsEnabled(), web.arena.Plc.GetArmorBlockStatuses(), + teams, } err = template.ExecuteTemplate(w, "base", data) if err != nil {