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

@@ -15,6 +15,7 @@ import (
"sort"
"strconv"
"text/template"
"time"
)
type MatchPlayListItem struct {
@@ -344,10 +345,36 @@ func CommitMatchScore(match *Match, matchResult *MatchResult) error {
return err
}
// Recalculate all the rankings.
err = db.CalculateRankings()
if err != nil {
return err
if match.Type == "qualification" {
// Recalculate all the rankings.
err = db.CalculateRankings()
if err != nil {
return err
}
}
if match.Type == "elimination" {
// Generate any subsequent elimination matches.
_, err = db.UpdateEliminationSchedule(time.Now().Add(time.Second * elimMatchSpacingSec))
if err != nil {
return err
}
}
if eventSettings.TbaPublishingEnabled && match.Type != "practice" {
// Publish asynchronously to The Blue Alliance.
go func() {
err = PublishMatches()
if err != nil {
log.Println(err)
}
if match.Type == "qualification" {
err = PublishRankings()
if err != nil {
log.Println(err)
}
}
}()
}
return nil