diff --git a/match_result.go b/match_result.go index 52358d8..7eea2fa 100644 --- a/match_result.go +++ b/match_result.go @@ -73,6 +73,18 @@ type ScoreSummary struct { Score int } +// Returns a new match result object with empty slices instead of nil. +func NewMatchResult() *MatchResult { + matchResult := new(MatchResult) + matchResult.RedScore.Cycles = []Cycle{} + matchResult.BlueScore.Cycles = []Cycle{} + matchResult.RedFouls = []Foul{} + matchResult.BlueFouls = []Foul{} + matchResult.Cards.YellowCardTeamIds = []int{} + matchResult.Cards.RedCardTeamIds = []int{} + return matchResult +} + func (database *Database) CreateMatchResult(matchResult *MatchResult) error { matchResultDb, err := matchResult.serialize() if err != nil { diff --git a/match_review.go b/match_review.go index d9ec569..edc8af6 100644 --- a/match_review.go +++ b/match_review.go @@ -140,7 +140,7 @@ func getMatchResultFromRequest(r *http.Request) (*Match, *MatchResult, error) { } if matchResult == nil { // We're scoring a match that hasn't been played yet, but that's okay. - matchResult = new(MatchResult) + matchResult = NewMatchResult() } return match, matchResult, nil diff --git a/static/css/cheesy-arena.css b/static/css/cheesy-arena.css index 66fa887..dc4830f 100644 --- a/static/css/cheesy-arena.css +++ b/static/css/cheesy-arena.css @@ -1,4 +1,4 @@ -// Bootstrap overrides. +/* Bootstrap overrides. */ .form-control[disabled] { cursor: default; } @@ -7,7 +7,7 @@ opacity: 0.2; } -// New styles. +/* New styles. */ .red-text { color: #f00; }