Added publishing to The Blue Alliance.

This commit is contained in:
Patrick Fairbank
2014-07-30 22:55:14 -07:00
parent 19f8aa7910
commit d77f2288e9
13 changed files with 363 additions and 81 deletions

View File

@@ -137,11 +137,6 @@ func AllianceSelectionFinalizeHandler(w http.ResponseWriter, r *http.Request) {
renderAllianceSelection(w, r, "Must specify a valid start time for the elimination rounds.")
return
}
matchSpacingSec, err := strconv.Atoi(r.PostFormValue("matchSpacingSec"))
if err != nil || matchSpacingSec <= 0 {
renderAllianceSelection(w, r, "Must specify a valid match spacing for the elimination rounds.")
return
}
// Check that all spots are filled.
for _, alliance := range cachedAlliances {
@@ -165,12 +160,26 @@ func AllianceSelectionFinalizeHandler(w http.ResponseWriter, r *http.Request) {
}
// Generate the first round of elimination matches.
_, err = db.UpdateEliminationSchedule(startTime, matchSpacingSec)
_, err = db.UpdateEliminationSchedule(startTime)
if err != nil {
handleWebErr(w, err)
return
}
if eventSettings.TbaPublishingEnabled {
// Publish alliances and schedule to The Blue Alliance.
err = PublishAlliances()
if err != nil {
handleWebErr(w, err)
return
}
err = PublishMatches()
if err != nil {
handleWebErr(w, err)
return
}
}
http.Redirect(w, r, "/setup/alliance_selection", 302)
}