Fix announcer display for final score fields.

This commit is contained in:
Patrick Fairbank
2020-04-25 15:20:35 -07:00
parent 2f74cdbd98
commit cc35643325
2 changed files with 6 additions and 53 deletions

View File

@@ -50,13 +50,6 @@ var handleRealtimeScore = function(data) {
// Handles a websocket message to populate the final score data.
var handleScorePosted = function(data) {
$.each(data.RedFouls, function(i, foul) {
Object.assign(foul, data.RulesViolated[foul.RuleId]);
});
$.each(data.BlueFouls, function(i, foul) {
Object.assign(foul, data.RulesViolated[foul.RuleId]);
});
var redRankings = {};
redRankings[data.Match.Red1] = getRankingText(data.Match.Red1, data.Rankings);
redRankings[data.Match.Red2] = getRankingText(data.Match.Red2, data.Rankings);
@@ -67,14 +60,9 @@ var handleScorePosted = function(data) {
blueRankings[data.Match.Blue3] = getRankingText(data.Match.Blue3, data.Rankings);
$("#scoreMatchName").text(data.MatchType + " Match " + data.Match.DisplayName);
$("#redScoreDetails").html(matchResultTemplate({score: data.RedScoreSummary, fouls: data.RedFouls,
rulesViolated: data.RulesViolated, cards: data.RedCards, rankings: redRankings}));
$("#blueScoreDetails").html(matchResultTemplate({score: data.BlueScoreSummary, fouls: data.BlueFouls,
rulesViolated: data.RulesViolated, cards: data.BlueCards, rankings: blueRankings}));
$("#redScoreDetails").html(matchResultTemplate({score: data.RedScoreSummary, rankings: redRankings}));
$("#blueScoreDetails").html(matchResultTemplate({score: data.BlueScoreSummary, rankings: blueRankings}));
$("#matchResult").modal("show");
// Activate tooltips above the foul listings.
$("[data-toggle=tooltip]").tooltip({"placement": "top"});
};
// Replaces newlines in team fields with HTML line breaks.

View File

@@ -62,56 +62,21 @@
<script id="matchResultTemplate" type="text/x-handlebars-template">
<h4>Score</h4>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Initiation Line Points</div>
<div class="col-lg-2">{{"{{score.InitiationLinePoints}}"}}</div>
<div class="col-lg-7 col-lg-offset-1 control-label">Auto Points</div>
<div class="col-lg-2">{{"{{score.AutoPoints}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Power Cell Points</div>
<div class="col-lg-2">{{"{{score.PowerCellPoints}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Control Panel Points</div>
<div class="col-lg-2">{{"{{score.ControlPanelPoints}}"}}</div>
<div class="col-lg-7 col-lg-offset-1 control-label">Teleop Points</div>
<div class="col-lg-2">{{"{{score.TeleopPoints}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Endgame Points</div>
<div class="col-lg-2">{{"{{score.EndgamePoints}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Foul Points</div>
<div class="col-lg-2">{{"{{score.FoulPoints}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Control Panel RP</div>
<div class="col-lg-2">{{"{{score.ControlPanelRankingPoint}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label">Endgame RP</div>
<div class="col-lg-2">{{"{{score.EndgameRankingPoint}}"}}</div>
</div>
<div class="row">
<div class="col-lg-7 col-lg-offset-1 control-label"><b>Final Score</b></div>
<div class="col-lg-2"><b>{{"{{score.Score}}"}}</b></div>
</div>
<h4>Fouls</h4>
{{"{{#each fouls}}"}}
<div class="row">
<div class="col-lg-3 col-lg-offset-1">
{{"{{#if IsRankingPoint}}"}}Free RP{{"{{else}}"}}{{"{{#if IsTechnical}}"}}Tech {{"{{/if}}"}}Foul{{"{{/if}}"}}
</div>
<div class="col-lg-3">Team {{"{{TeamId}}"}}</div>
<div class="col-lg-3" data-toggle="tooltip" title="{{"{{Description}}"}}">{{"{{RuleNumber}}"}}</div>
</div>
{{"{{/each}}"}}
<h4>Cards</h4>
{{"{{#eachMapEntry cards}}"}}
{{"{{#if this.value}}"}}
<div class="row">
<div class="col-lg-3 col-lg-offset-1">Team {{"{{this.key}}"}}</div>
<div class="col-lg-3 col-lg-offset-1" style="text-transform: capitalize;">{{"{{this.value}}"}}</div>
</div>
{{"{{/if}}"}}
{{"{{/eachMapEntry}}"}}
<h4>Rankings</h4>
{{"{{#eachMapEntry rankings}}"}}
{{"{{#if this.value}}"}}