From 1896136abd7dd838612ebdd2c78860c0e87b6106 Mon Sep 17 00:00:00 2001 From: Patrick Fairbank Date: Mon, 22 Aug 2022 17:16:04 -0700 Subject: [PATCH] Don't show 0-0 scores on match review page for matches that haven't been played yet. --- templates/match_review.html | 4 ++-- web/match_review.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/templates/match_review.html b/templates/match_review.html index e2dccfa..c67b46a 100644 --- a/templates/match_review.html +++ b/templates/match_review.html @@ -44,8 +44,8 @@ {{index $match.BlueTeams 0}}, {{index $match.BlueTeams 1}}, {{index $match.BlueTeams 2}} - {{$match.RedScore}} - {{$match.BlueScore}} + {{if $match.IsComplete}}{{$match.RedScore}}{{end}} + {{if $match.IsComplete}}{{$match.BlueScore}}{{end}} Edit diff --git a/web/match_review.go b/web/match_review.go index 74c8f46..6046bb8 100755 --- a/web/match_review.go +++ b/web/match_review.go @@ -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 } }