|
|
|
@ -1314,18 +1314,22 @@ func (s *Server) handleNextHeat() http.HandlerFunc {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Broadcast event to admin page
|
|
|
|
// Broadcast event to admin page
|
|
|
|
select {
|
|
|
|
s.broadcastAdminEvent("heat-changed")
|
|
|
|
case s.adminEvents <- "heat-changed":
|
|
|
|
|
|
|
|
// Event sent
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Channel full, non-blocking
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// broadcastAdminEvent sends an event to all admin clients
|
|
|
|
|
|
|
|
func (s *Server) broadcastAdminEvent(event string) {
|
|
|
|
|
|
|
|
// Create a simple event message
|
|
|
|
|
|
|
|
eventMsg := fmt.Sprintf(`{"event":"%s"}`, event)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Send to all admin clients
|
|
|
|
|
|
|
|
s.adminEvents <- eventMsg
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// handlePreviousHeat goes back to the previous heat
|
|
|
|
// handlePreviousHeat goes back to the previous heat
|
|
|
|
func (s *Server) handlePreviousHeat() http.HandlerFunc {
|
|
|
|
func (s *Server) handlePreviousHeat() http.HandlerFunc {
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
@ -1364,12 +1368,7 @@ func (s *Server) handlePreviousHeat() http.HandlerFunc {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Broadcast event to admin page
|
|
|
|
// Broadcast event to admin page
|
|
|
|
select {
|
|
|
|
s.broadcastAdminEvent("heat-changed")
|
|
|
|
case s.adminEvents <- "heat-changed":
|
|
|
|
|
|
|
|
// Event sent
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Channel full, non-blocking
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
@ -1456,12 +1455,7 @@ func (s *Server) handleRerunHeat() http.HandlerFunc {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Broadcast event to admin page
|
|
|
|
// Broadcast event to admin page
|
|
|
|
select {
|
|
|
|
s.broadcastAdminEvent("heat-rerun")
|
|
|
|
case s.adminEvents <- "heat-rerun":
|
|
|
|
|
|
|
|
// Event sent
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Channel full, non-blocking
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
@ -1494,12 +1488,7 @@ func (s *Server) handleSetRacingGroup() http.HandlerFunc {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Broadcast event to admin page
|
|
|
|
// Broadcast event to admin page
|
|
|
|
select {
|
|
|
|
s.broadcastAdminEvent("group-changed")
|
|
|
|
case s.adminEvents <- "group-changed":
|
|
|
|
|
|
|
|
// Event sent
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Channel full, non-blocking
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
|
|
|
|
|