Refactor to merge Match.Status and Match.Winner fields into one.

This commit is contained in:
Patrick Fairbank
2020-03-29 00:04:15 -07:00
parent 14c9815980
commit df9c5dfbd9
20 changed files with 134 additions and 125 deletions

View File

@@ -319,7 +319,7 @@ func (client *TbaClient) PublishMatches(database *model.Database) error {
var scoreBreakdown map[string]*TbaScoreBreakdown
var redScore, blueScore *int
var redCards, blueCards map[string]string
if match.Status == "complete" {
if match.IsComplete() {
matchResult, err := database.GetMatchResultForMatch(match.Id)
if err != nil {
return err

View File

@@ -42,7 +42,7 @@ func TestPublishMatches(t *testing.T) {
database := setupTestDb(t)
match1 := model.Match{Type: "qualification", DisplayName: "2", Time: time.Unix(600, 0), Red1: 7, Red2: 8, Red3: 9,
Blue1: 10, Blue2: 11, Blue3: 12, Status: "complete"}
Blue1: 10, Blue2: 11, Blue3: 12, Status: model.RedWonMatch}
match2 := model.Match{Type: "elimination", DisplayName: "SF2-2", ElimRound: 2, ElimGroup: 2, ElimInstance: 2}
database.CreateMatch(&match1)
database.CreateMatch(&match2)