mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Set display name when pushing double-elimination matches to TBA.
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -38,6 +39,7 @@ type TbaMatch struct {
|
|||||||
Alliances map[string]*TbaAlliance `json:"alliances"`
|
Alliances map[string]*TbaAlliance `json:"alliances"`
|
||||||
TimeString string `json:"time_string"`
|
TimeString string `json:"time_string"`
|
||||||
TimeUtc string `json:"time_utc"`
|
TimeUtc string `json:"time_utc"`
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TbaAlliance struct {
|
type TbaAlliance struct {
|
||||||
@@ -331,8 +333,14 @@ func (client *TbaClient) PublishMatches(database *model.Database) error {
|
|||||||
alliances["blue"] = createTbaAlliance([3]int{match.Blue1, match.Blue2, match.Blue3},
|
alliances["blue"] = createTbaAlliance([3]int{match.Blue1, match.Blue2, match.Blue3},
|
||||||
[3]bool{match.Blue1IsSurrogate, match.Blue2IsSurrogate, match.Blue3IsSurrogate}, blueScore)
|
[3]bool{match.Blue1IsSurrogate, match.Blue2IsSurrogate, match.Blue3IsSurrogate}, blueScore)
|
||||||
|
|
||||||
tbaMatches[i] = TbaMatch{"qm", 0, matchNumber, alliances, match.Time.Local().Format("3:04 PM"),
|
tbaMatches[i] = TbaMatch{
|
||||||
match.Time.UTC().Format("2006-01-02T15:04:05")}
|
CompLevel: "qm",
|
||||||
|
SetNumber: 0,
|
||||||
|
MatchNumber: matchNumber,
|
||||||
|
Alliances: alliances,
|
||||||
|
TimeString: match.Time.Local().Format("3:04 PM"),
|
||||||
|
TimeUtc: match.Time.UTC().Format("2006-01-02T15:04:05"),
|
||||||
|
}
|
||||||
if match.Type == "elimination" {
|
if match.Type == "elimination" {
|
||||||
setElimMatchKey(&tbaMatches[i], &match, eventSettings.ElimType)
|
setElimMatchKey(&tbaMatches[i], &match, eventSettings.ElimType)
|
||||||
}
|
}
|
||||||
@@ -553,5 +561,8 @@ func setElimMatchKey(tbaMatch *TbaMatch, match *model.Match, elimType string) {
|
|||||||
tbaMatch.SetNumber = tbaKey.setNumber
|
tbaMatch.SetNumber = tbaKey.setNumber
|
||||||
}
|
}
|
||||||
tbaMatch.MatchNumber = match.ElimInstance
|
tbaMatch.MatchNumber = match.ElimInstance
|
||||||
|
if !strings.HasPrefix(match.DisplayName, "F") {
|
||||||
|
tbaMatch.DisplayName = "Match " + match.DisplayName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user