Update match review for 2019.

This commit is contained in:
Patrick Fairbank
2019-07-26 23:00:11 -07:00
parent ad1891cd91
commit 23bdfe9bf6
5 changed files with 260 additions and 261 deletions

View File

@@ -32,36 +32,35 @@ var renderResults = function(alliance) {
$("#" + alliance + "Score").html(scoreContent);
// Set the values of the form fields from the JSON results data.
$("input[name=" + alliance + "AutoRuns]").val(result.score.AutoRuns);
$("input[name=" + alliance + "AutoScaleOwnershipSec]").val(result.score.AutoScaleOwnershipSec);
$("input[name=" + alliance + "AutoSwitchOwnershipSec]").val(result.score.AutoSwitchOwnershipSec);
$("input[name=" + alliance + "AutoEndSwitchOwnership]").prop("checked", result.score.AutoEndSwitchOwnership);
$("input[name=" + alliance + "TeleopScaleOwnershipSec]").val(result.score.TeleopScaleOwnershipSec);
$("input[name=" + alliance + "TeleopScaleBoostSec]").val(result.score.TeleopScaleBoostSec);
$("input[name=" + alliance + "TeleopSwitchOwnershipSec]").val(result.score.TeleopSwitchOwnershipSec);
$("input[name=" + alliance + "TeleopSwitchBoostSec]").val(result.score.TeleopSwitchBoostSec);
$("input[name=" + alliance + "ForceCubes]").val(result.score.ForceCubes);
$("input[name=" + alliance + "ForceCubesPlayed]").val(result.score.ForceCubesPlayed);
$("input[name=" + alliance + "LevitateCubes]").val(result.score.LevitateCubes);
$("input[name=" + alliance + "LevitatePlayed]").prop("checked", result.score.LevitatePlayed);
$("input[name=" + alliance + "BoostCubes]").val(result.score.BoostCubes);
$("input[name=" + alliance + "BoostCubesPlayed]").val(result.score.BoostCubesPlayed);
$("input[name=" + alliance + "Climbs]").val(result.score.Climbs);
$("input[name=" + alliance + "Parks]").val(result.score.Parks);
for (var i = 0; i < 3; i++) {
var i1 = i + 1;
getInputElement(alliance, "RobotStartLevel" + i1, result.score.RobotStartLevels[i]).prop("checked", true);
getInputElement(alliance, "SandstormBonus" + i1).prop("checked", result.score.SandstormBonuses[i]);
getInputElement(alliance, "RobotEndLevel" + i1, result.score.RobotEndLevels[i]).prop("checked", true);
getSelectElement(alliance, "RocketNearLeftBay" + i1).val(result.score.RocketNearLeftBays[i]);
getSelectElement(alliance, "RocketNearRightBay" + i1).val(result.score.RocketNearRightBays[i]);
getSelectElement(alliance, "RocketFarLeftBay" + i1).val(result.score.RocketFarLeftBays[i]);
getSelectElement(alliance, "RocketFarRightBay" + i1).val(result.score.RocketFarRightBays[i]);
}
for (var i = 0; i < 8; i++) {
var i1 = i + 1;
getSelectElement(alliance, "CargoBayPreMatch" + i1).val(result.score.CargoBaysPreMatch[i]);
getSelectElement(alliance, "CargoBay" + i1).val(result.score.CargoBays[i]);
}
if (result.score.Fouls != null) {
$.each(result.score.Fouls, function(k, v) {
$("input[name=" + alliance + "Foul" + k + "Team][value=" + v.TeamId + "]").prop("checked", true);
$("input[name=" + alliance + "Foul" + k + "RuleNumber]").val(v.RuleNumber);
$("input[name=" + alliance + "Foul" + k + "IsTechnical]").prop("checked", v.IsTechnical);
$("input[name=" + alliance + "Foul" + k + "Time]").val(v.TimeInMatchSec);
getInputElement(alliance, "Foul" + k + "Team", v.TeamId).prop("checked", true);
getInputElement(alliance, "Foul" + k + "RuleNumber").val(v.RuleNumber);
getInputElement(alliance, "Foul" + k + "IsTechnical").prop("checked", v.IsTechnical);
getInputElement(alliance, "Foul" + k + "IsRankingPoint").prop("checked", v.IsRankingPoint);
getInputElement(alliance, "Foul" + k + "Time").val(v.TimeInMatchSec);
});
}
if (result.cards != null) {
$.each(result.cards, function(k, v) {
$("input[name=" + alliance + "Team" + k + "Card][value=" + v + "]").prop("checked", true);
getInputElement(alliance, "Team" + k + "Card", v).prop("checked", true);
});
}
};
@@ -74,28 +73,35 @@ var updateResults = function(alliance) {
formData[v.name] = v.value;
});
result.score.AutoRuns = parseInt(formData[alliance + "AutoRuns"]);
result.score.AutoScaleOwnershipSec = parseFloat(formData[alliance + "AutoScaleOwnershipSec"]);
result.score.AutoSwitchOwnershipSec = parseFloat(formData[alliance + "AutoSwitchOwnershipSec"]);
result.score.AutoEndSwitchOwnership = formData[alliance + "AutoEndSwitchOwnership"] === "on";
result.score.TeleopScaleOwnershipSec = parseFloat(formData[alliance + "TeleopScaleOwnershipSec"]);
result.score.TeleopScaleBoostSec = parseFloat(formData[alliance + "TeleopScaleBoostSec"]);
result.score.TeleopSwitchOwnershipSec = parseFloat(formData[alliance + "TeleopSwitchOwnershipSec"]);
result.score.TeleopSwitchBoostSec = parseFloat(formData[alliance + "TeleopSwitchBoostSec"]);
result.score.ForceCubes = parseInt(formData[alliance + "ForceCubes"]);
result.score.ForceCubesPlayed = parseInt(formData[alliance + "ForceCubesPlayed"]);
result.score.LevitateCubes = parseInt(formData[alliance + "LevitateCubes"]);
result.score.LevitatePlayed = formData[alliance + "LevitatePlayed"] === "on";
result.score.BoostCubes = parseInt(formData[alliance + "BoostCubes"]);
result.score.BoostCubesPlayed = parseInt(formData[alliance + "BoostCubesPlayed"]);
result.score.Climbs = parseInt(formData[alliance + "Climbs"]);
result.score.Parks = parseInt(formData[alliance + "Parks"]);
result.score.RobotStartLevels = [];
result.score.SandstormBonuses = [];
result.score.CargoBaysPreMatch = [];
result.score.CargoBays = [];
result.score.RocketNearLeftBays = [];
result.score.RocketNearRightBays = [];
result.score.RocketFarLeftBays = [];
result.score.RocketFarRightBays = [];
result.score.RobotEndLevels = [];
for (var i = 0; i < 3; i++) {
result.score.RobotStartLevels[i] = parseInt(formData[alliance + "RobotStartLevel" + (i + 1)]);
result.score.SandstormBonuses[i] = formData[alliance + "SandstormBonus" + (i + 1)] === "on";
result.score.RobotEndLevels[i] = parseInt(formData[alliance + "RobotEndLevel" + (i + 1)]);
result.score.RocketNearLeftBays[i] = parseInt(formData[alliance + "RocketNearLeftBay" + (i + 1)]);
result.score.RocketNearRightBays[i] = parseInt(formData[alliance + "RocketNearRightBay" + (i + 1)]);
result.score.RocketFarLeftBays[i] = parseInt(formData[alliance + "RocketFarLeftBay" + (i + 1)]);
result.score.RocketFarRightBays[i] = parseInt(formData[alliance + "RocketFarRightBay" + (i + 1)]);
}
for (var i = 0; i < 8; i++) {
result.score.CargoBaysPreMatch[i] = parseInt(formData[alliance + "CargoBayPreMatch" + (i + 1)]);
result.score.CargoBays[i] = parseInt(formData[alliance + "CargoBay" + (i + 1)]);
}
result.score.Fouls = [];
for (var i = 0; formData[alliance + "Foul" + i + "Time"]; i++) {
var prefix = alliance + "Foul" + i;
var foul = {TeamId: parseInt(formData[prefix + "Team"]), RuleNumber: formData[prefix + "RuleNumber"],
IsTechnical: formData[prefix + "IsTechnical"] === "on",
IsRankingPoint: formData[prefix + "IsRankingPoint"] === "on",
TimeInMatchSec: parseFloat(formData[prefix + "Time"])};
result.score.Fouls.push(foul);
}
@@ -121,3 +127,18 @@ var deleteFoul = function(alliance, index) {
result.score.Fouls.splice(index, 1);
renderResults(alliance);
};
// Returns the form input element having the given parameters.
var getInputElement = function(alliance, name, value) {
var selector = "input[name=" + alliance + name + "]";
if (value !== undefined) {
selector += "[value=" + value + "]";
}
return $(selector);
};
// Returns the form select element having the given parameters.
var getSelectElement = function(alliance, name) {
var selector = "select[name=" + alliance + name + "]";
return $(selector);
};

View File

@@ -116,7 +116,7 @@
</div>
<div class="modal-body">
<p>A field management system that just works.</p>
<p>Copyright &copy; 2014-2018 Team 254. All Rights Reserved.</p>
<p>Copyright &copy; 2014-2019 Team 254. All Rights Reserved.</p>
<p><a href="https://github.com/Team254/cheesy-arena">https://github.com/Team254/cheesy-arena</a></p>
</div>
<div class="modal-footer">

View File

@@ -25,247 +25,198 @@
</div>
<div id="scoreTemplate" style="display: none;">
<div class="well well-{{"{{alliance}}"}}">
<legend>Autonomous</legend>
<div class="form-group">
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Scale Owned Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}AutoScaleOwnershipSec">
<fieldset>
<legend>Pre-Match</legend>
<b>Robot Starting Levels</b>
<div class="form-group">
{{range $i := seq 3}}
<div class="row">
<label class="col-lg-4 control-label">Team {{"{{team"}}{{$i}}{{"}}"}}</label>
<div class="radio col-lg-2">
<input type="radio" name="{{"{{alliance}}"}}RobotStartLevel{{$i}}" value="1">Level 1
</div>
<div class="radio col-lg-2">
<input type="radio" name="{{"{{alliance}}"}}RobotStartLevel{{$i}}" value="2">Level 2
</div>
<div class="radio col-lg-4">
<input type="radio" name="{{"{{alliance}}"}}RobotStartLevel{{$i}}" value="3">No-Show
</div>
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-8 control-label">Auto Runs</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}AutoRuns">
{{end}}
</div>
<b>Cargo Ship Prepopulation</b>
<p>Counting starts nearest center field on scoring table side and wraps around</p>
<div class="form-group">
{{range $i, $unused := seq 2}}
<div class="row">
{{range $j := seq 4}}
{{$bayNumber := add $j (multiply $i 4)}}
<div class="col-lg-3">
{{$bayNumber}}:
<select name="{{"{{alliance}}"}}CargoBayPreMatch{{$bayNumber}}">
<option value="0">Empty</option>
<option value="1">Null Hatch</option>
<option value="3">Cargo</option>
</select>
</div>
{{end}}
</div>
{{end}}
</div>
</fieldset>
<fieldset>
<legend>In-Match</legend>
<b>Sandstorm Bonus</b>
<div class="form-group">
<div class="row">
{{range $i := seq 3}}
<div class="col-lg-4">
<label class="col-lg-8 control-label">Team {{"{{team"}}{{$i}}{{"}}"}}</label>
<input type="checkbox" class="input-sm" name="{{"{{alliance}}"}}SandstormBonus{{$i}}">
</div>
{{end}}
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Switch Owned Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}AutoSwitchOwnershipSec">
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-9 control-label">Owned Switch at End</label>
<div class="col-lg-3">
<input type="checkbox" class="input-sm" name="{{"{{alliance}}"}}AutoEndSwitchOwnership">
<b>Cargo Ship</b>
<p>Counting starts nearest center field on scoring table side and wraps around</p>
<div class="form-group">
{{range $i, $unused := seq 2}}
<div class="row">
{{range $j := seq 4}}
{{$bayNumber := add $j (multiply $i 4)}}
<div class="col-lg-3">
{{$bayNumber}}:
<select name="{{"{{alliance}}"}}CargoBay{{$bayNumber}}">
<option value="0">Empty</option>
<option value="1">Hatch Only</option>
<option value="2">H+Cargo</option>
</select>
</div>
{{end}}
</div>
{{end}}
</div>
<b>Rockets</b>
<div class="form-group">
<div class="row text-center">
{{template "rocketHalf" dict "rocketName" "Near Left" "rocketId" "NearLeft"}}
{{template "rocketHalf" dict "rocketName" "Near Right" "rocketId" "NearRight"}}
{{template "rocketHalf" dict "rocketName" "Far Left" "rocketId" "FarLeft"}}
{{template "rocketHalf" dict "rocketName" "Far Right" "rocketId" "FarRight"}}
</div>
</div>
</div>
<legend>Teleoperated</legend>
<div class="form-group">
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Scale Owned Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}TeleopScaleOwnershipSec">
<b>Robot Ending Levels</b>
<div class="form-group">
{{range $i := seq 3}}
<div class="row">
<label class="col-lg-2 control-label">Team {{"{{team"}}{{$i}}{{"}}"}}</label>
<div class="radio col-lg-3">
<input type="radio" name="{{"{{alliance}}"}}RobotEndLevel{{$i}}" value="0">Not On Hab
</div>
<div class="radio col-lg-2">
<input type="radio" name="{{"{{alliance}}"}}RobotEndLevel{{$i}}" value="1">Level 1
</div>
<div class="radio col-lg-2">
<input type="radio" name="{{"{{alliance}}"}}RobotEndLevel{{$i}}" value="2">Level 2
</div>
<div class="radio col-lg-2">
<input type="radio" name="{{"{{alliance}}"}}RobotEndLevel{{$i}}" value="3">Level 3
</div>
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-8 control-label">Scale Boost Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}TeleopScaleBoostSec">
</div>
</div>
{{end}}
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Switch Owned Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}TeleopSwitchOwnershipSec">
</fieldset>
<fieldset>
<legend>Fouls</legend>
{{"{{#each score.Fouls}}"}}
<div class="well well-sm well-dark{{"{{../alliance}}"}}">
<button type="button" class="close" onclick="deleteFoul('{{"{{../alliance}}"}}', {{"{{@index}}"}});">
×
</button>
<br />
<div class="form-group">
<label class="col-lg-4 control-label">Team</label>
<div class="col-lg-8">
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team1}}"}}">
{{"{{../team1}}"}}
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team2}}"}}">
{{"{{../team2}}"}}
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team3}}"}}">
{{"{{../team3}}"}}
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Rule Violated</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm"
name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}RuleNumber">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Is Technical</label>
<div class="col-lg-3">
<input type="checkbox" class="input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}IsTechnical">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Free Ranking Point</label>
<div class="col-lg-3">
<input type="checkbox" class="input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}IsRankingPoint">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Seconds Into Match</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Time">
</div>
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-8 control-label">Switch Boost Sec.</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}TeleopSwitchBoostSec">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Force Cubes</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}ForceCubes">
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-9 control-label">Force Played</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}ForceCubesPlayed">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Levitate Cubes</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}LevitateCubes">
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-9 control-label">Levitate Played</label>
<div class="col-lg-3">
<input type="checkbox" class="input-sm" name="{{"{{alliance}}"}}LevitatePlayed">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Boost Cubes</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}BoostCubes">
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-9 control-label">Boost Played</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}BoostCubesPlayed">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label class="col-lg-8 control-label">Parks</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}Parks">
</div>
</div>
<div class="col-lg-6">
<label class="col-lg-8 control-label">Climbs</label>
<div class="col-lg-4">
<input type="text" class="form-control input-sm" name="{{"{{alliance}}"}}Climbs">
</div>
</div>
</div>
</div>
<br /><br />
<legend>Fouls</legend>
{{"{{#each score.Fouls}}"}}
<div class="well well-sm well-dark{{"{{../alliance}}"}}">
<button type="button" class="close" onclick="deleteFoul('{{"{{../alliance}}"}}', {{"{{@index}}"}});">×</button>
<br />
{{"{{/each}}"}}
<button type="button" class="btn btn-default btn-sm" onclick="addFoul('{{"{{alliance}}"}}');">
Add Foul
</button>
<br /><br />
</fieldset>
<fieldset>
<legend>Cards</legend>
{{range $i := seq 3}}
<div class="form-group">
<label class="col-lg-4 control-label">Team</label>
<label class="col-lg-4 control-label">Team {{"{{team"}}{{$i}}{{"}}"}}</label>
<div class="col-lg-8">
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team1}}"}}">
{{"{{../team1}}"}}
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team2}}"}}">
{{"{{../team2}}"}}
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team"}}{{$i}}{{"}}"}}Card" value="" checked>
None
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Team" value="{{"{{../team3}}"}}">
{{"{{../team3}}"}}
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team"}}{{$i}}{{"}}"}}Card" value="yellow">
Yellow
</label>
</div>
<div class="radio col-lg-6">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team"}}{{$i}}{{"}}"}}Card" value="red">
Red
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Rule Violated</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}RuleNumber">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Is Technical</label>
<div class="col-lg-3">
<input type="checkbox" class="input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}IsTechnical">
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Seconds Into Match</label>
<div class="col-lg-3">
<input type="text" class="form-control input-sm" name="{{"{{../alliance}}"}}Foul{{"{{@index}}"}}Time">
</div>
</div>
</div>
{{"{{/each}}"}}
<button type="button" class="btn btn-default btn-sm" onclick="addFoul('{{"{{alliance}}"}}');">
Add Foul
</button>
<br /><br />
<legend>Cards</legend>
<div class="form-group">
<label class="col-lg-4 control-label">Team {{"{{team1}}"}}</label>
<div class="col-lg-8">
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team1}}"}}Card" value="" checked>
None
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team1}}"}}Card" value="yellow">
Yellow
</label>
</div>
<div class="radio col-lg-6">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team1}}"}}Card" value="red">
Red
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Team {{"{{team2}}"}}</label>
<div class="col-lg-8">
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team2}}"}}Card" value="" checked>
None
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team2}}"}}Card" value="yellow">
Yellow
</label>
</div>
<div class="radio col-lg-6">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team2}}"}}Card" value="red">
Red
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Team {{"{{team3}}"}}</label>
<div class="col-lg-8">
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team3}}"}}Card" value="" checked>
None
</label>
</div>
<div class="radio col-lg-3">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team3}}"}}Card" value="yellow">
Yellow
</label>
</div>
<div class="radio col-lg-6">
<label>
<input type="radio" name="{{"{{alliance}}"}}Team{{"{{team3}}"}}Card" value="red">
Red
</label>
</div>
</div>
</div>
{{end}}
</fieldset>
</div>
</div>
{{end}}
@@ -284,3 +235,18 @@
renderResults("blue");
</script>
{{end}}
{{define "rocketHalf"}}
<div class="col-lg-3">
<div class="row">{{.rocketName}}</div>
<div class="row">H: {{template "rocketBay" dict "rocketId" .rocketId "level" "3"}}</div>
<div class="row">M: {{template "rocketBay" dict "rocketId" .rocketId "level" "2"}}</div>
<div class="row">L: {{template "rocketBay" dict "rocketId" .rocketId "level" "1"}}</div>
</div>
{{end}}
{{define "rocketBay"}}
<select name="{{"{{alliance}}"}}Rocket{{.rocketId}}Bay{{.level}}">
<option value="0">Empty</option>
<option value="1">Hatch Only</option>
<option value="2">H+Cargo</option>
</select>
{{end}}

View File

@@ -62,18 +62,17 @@ func TestMatchReviewEditExistingResult(t *testing.T) {
assert.Contains(t, recorder.Body.String(), "QF4-3")
// Update the score to something else.
postBody := "redScoreJson={\"AutoRuns\":3}&blueScoreJson={\"VaultCubes\":3," +
postBody := "redScoreJson={\"RobotEndLevels\":[0,3,0]}&blueScoreJson={\"CargoBays\":[0,2,1,2,2,0,1]," +
"\"Fouls\":[{\"TeamId\":973,\"Rule\":\"G22\"}]}&redCardsJson={\"105\":\"yellow\"}&blueCardsJson={}"
recorder = web.postHttpResponse(fmt.Sprintf("/match_review/%d/edit", match.Id), postBody)
assert.Equal(t, 303, recorder.Code)
// TODO(pat): Update for 2019.
// Check for the updated scores back on the match list page.
recorder = web.getHttpResponse("/match_review")
assert.Equal(t, 200, recorder.Code)
assert.Contains(t, recorder.Body.String(), "QF4-3")
assert.Contains(t, recorder.Body.String(), "5") // The red score
assert.Contains(t, recorder.Body.String(), "0") // The blue score
assert.Contains(t, recorder.Body.String(), "17") // The red score
assert.Contains(t, recorder.Body.String(), "19") // The blue score
}
func TestMatchReviewCreateNewResult(t *testing.T) {

View File

@@ -49,6 +49,19 @@ func NewWeb(arena *field.Arena) *Web {
}
return dict, nil
},
"add": func(a, b int) int {
return a + b
},
"multiply": func(a, b int) int {
return a * b
},
"seq": func(count int) []int {
seq := make([]int, count)
for i := 0; i < count; i++ {
seq[i] = i + 1
}
return seq
},
}
return web