|
|
|
@ -425,7 +425,7 @@ func (s *Server) broadcastRaceEvent(event derby.Event) {
|
|
|
|
switch event.Type {
|
|
|
|
switch event.Type {
|
|
|
|
case derby.EventRaceStart:
|
|
|
|
case derby.EventRaceStart:
|
|
|
|
s.logger.Info("Broadcasting race start event")
|
|
|
|
s.logger.Info("Broadcasting race start event")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-success'>Race Running</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-success'>Race Running</div>\n\n")
|
|
|
|
heatGroup, _ := s.db.GetCurrentRacingGroup()
|
|
|
|
heatGroup, _ := s.db.GetCurrentRacingGroup()
|
|
|
|
heatResult.GroupID = heatGroup.ID
|
|
|
|
heatResult.GroupID = heatGroup.ID
|
|
|
|
heatResult.HeatNumber, _ = s.db.GetCurrentHeatNumber(heatGroup.ID)
|
|
|
|
heatResult.HeatNumber, _ = s.db.GetCurrentHeatNumber(heatGroup.ID)
|
|
|
|
@ -455,7 +455,7 @@ func (s *Server) broadcastRaceEvent(event derby.Event) {
|
|
|
|
|
|
|
|
|
|
|
|
case derby.EventRaceComplete:
|
|
|
|
case derby.EventRaceComplete:
|
|
|
|
s.logger.Info("Broadcasting race complete event")
|
|
|
|
s.logger.Info("Broadcasting race complete event")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-warning'>Race Complete</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-warning'>Race Complete</div>\n\n")
|
|
|
|
s.db.SaveHeatResult(heatResult)
|
|
|
|
s.db.SaveHeatResult(heatResult)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -719,7 +719,7 @@ func (s *Server) handleReset() http.HandlerFunc {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-warning'>Ready</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-warning'>Ready</div>\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
w.Write([]byte(`{"status": "reset"}`))
|
|
|
|
w.Write([]byte(`{"status": "reset"}`))
|
|
|
|
@ -1691,7 +1691,7 @@ func (s *Server) handleNextHeat() http.HandlerFunc {
|
|
|
|
Event: *heatData,
|
|
|
|
Event: *heatData,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-primary'>Idle</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-primary'>Idle</div>\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
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"})
|
|
|
|
@ -1738,7 +1738,7 @@ func (s *Server) handlePreviousHeat() http.HandlerFunc {
|
|
|
|
Event: *heatData,
|
|
|
|
Event: *heatData,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-primary'>Idle</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-primary'>Idle</div>\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
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"})
|
|
|
|
@ -1779,7 +1779,7 @@ func (s *Server) handleRerunHeat() http.HandlerFunc {
|
|
|
|
Event: *heatData,
|
|
|
|
Event: *heatData,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-primary'>Idle</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-primary'>Idle</div>\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
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"})
|
|
|
|
@ -1821,7 +1821,7 @@ func (s *Server) handleSetRacingGroup() http.HandlerFunc {
|
|
|
|
Event: heatResults,
|
|
|
|
Event: heatResults,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-50 text-center align-middle badge bg-primary'>Idle</div>\n\n")
|
|
|
|
s.sendRaceEventToAllClients("event: race-status\ndata: <div id='status-indicator' class='w-25 h-100 d-inline-flex align-items-center justify-content-center badge bg-primary'>Idle</div>\n\n")
|
|
|
|
|
|
|
|
|
|
|
|
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"})
|
|
|
|
|