mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Added WPA key CSV export.
This commit is contained in:
19
reports.go
19
reports.go
@@ -276,6 +276,25 @@ func TeamsPdfReportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Generates a CSV-formatted report of the WPA keys, for import into the radio kiosk.
|
||||
func WpaKeysCsvReportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
teams, err := db.GetAllTeams()
|
||||
if err != nil {
|
||||
handleWebErr(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/csv")
|
||||
w.Header().Set("Content-Disposition", "attachment; filename=wpa_keys.csv")
|
||||
for _, team := range teams {
|
||||
_, err := w.Write([]byte(fmt.Sprintf("%d,%s\r\n", team.Id, team.WpaKey)))
|
||||
if err != nil {
|
||||
handleWebErr(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the text to display if a team is a surrogate.
|
||||
func surrogateText(isSurrogate bool) string {
|
||||
if isSurrogate {
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<li><a target="_blank" href="/reports/csv/schedule/qualification">Qualification Schedule</a></li>
|
||||
<li><a target="_blank" href="/reports/csv/schedule/elimination">Elimination Schedule</a></li>
|
||||
<li><a target="_blank" href="/reports/csv/rankings">Standings</a></li>
|
||||
<li><a target="_blank" href="/reports/csv/wpa_keys">WPA Keys</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
1
web.go
1
web.go
@@ -138,6 +138,7 @@ func newHandler() http.Handler {
|
||||
router.HandleFunc("/reports/pdf/schedule/{type}", SchedulePdfReportHandler).Methods("GET")
|
||||
router.HandleFunc("/reports/csv/teams", TeamsCsvReportHandler).Methods("GET")
|
||||
router.HandleFunc("/reports/pdf/teams", TeamsPdfReportHandler).Methods("GET")
|
||||
router.HandleFunc("/reports/csv/wpa_keys", WpaKeysCsvReportHandler).Methods("GET")
|
||||
router.HandleFunc("/displays/audience", AudienceDisplayHandler).Methods("GET")
|
||||
router.HandleFunc("/displays/audience/websocket", AudienceDisplayWebsocketHandler).Methods("GET")
|
||||
router.HandleFunc("/displays/pit", PitDisplayHandler).Methods("GET")
|
||||
|
||||
Reference in New Issue
Block a user