Don't show 0-0 scores on match review page for matches that haven't been played yet.

This commit is contained in:
Patrick Fairbank
2022-08-22 17:16:04 -07:00
parent 4d3d270a0f
commit 1896136abd
2 changed files with 7 additions and 2 deletions

View File

@@ -44,8 +44,8 @@
<td class="text-center blue-text">
{{index $match.BlueTeams 0}}, {{index $match.BlueTeams 1}}, {{index $match.BlueTeams 2}}
</td>
<td class="text-center red-text">{{$match.RedScore}}</td>
<td class="text-center blue-text">{{$match.BlueScore}}</td>
<td class="text-center red-text">{{if $match.IsComplete}}{{$match.RedScore}}{{end}}</td>
<td class="text-center blue-text">{{if $match.IsComplete}}{{$match.BlueScore}}{{end}}</td>
<td class="text-center nowrap">
<a href="/match_review/{{$match.Id}}/edit"><b class="btn btn-info btn-xs">Edit</b></a>
</td>

View File

@@ -24,6 +24,7 @@ type MatchReviewListItem struct {
RedScore int
BlueScore int
ColorClass string
IsComplete bool
}
// Shows the match review interface.
@@ -196,12 +197,16 @@ func (web *Web) buildMatchReviewList(matchType string) ([]MatchReviewListItem, e
switch match.Status {
case game.RedWonMatch:
matchReviewList[i].ColorClass = "danger"
matchReviewList[i].IsComplete = true
case game.BlueWonMatch:
matchReviewList[i].ColorClass = "info"
matchReviewList[i].IsComplete = true
case game.TieMatch:
matchReviewList[i].ColorClass = "warning"
matchReviewList[i].IsComplete = true
default:
matchReviewList[i].ColorClass = ""
matchReviewList[i].IsComplete = false
}
}