Convert EventSettings, Match, and MatchResult models to use Bolt DB.

This commit is contained in:
Patrick Fairbank
2021-05-12 16:40:07 -07:00
parent ea4d56e665
commit 1d523c5f37
28 changed files with 274 additions and 375 deletions

View File

@@ -5,18 +5,19 @@
var scoreTemplate = Handlebars.compile($("#scoreTemplate").html());
var allianceResults = {};
var matchResult;
// Hijack the form submission to inject the data in JSON form so that it's easier for the server to parse.
$("form").submit(function() {
updateResults("red");
updateResults("blue");
var redScoreJson = JSON.stringify(allianceResults["red"].score);
var blueScoreJson = JSON.stringify(allianceResults["blue"].score);
matchResult.RedScore = allianceResults["red"].score;
matchResult.BlueScore = allianceResults["blue"].score;
var matchResultJson = JSON.stringify(matchResult);
// Inject the JSON data into the form as hidden inputs.
$("<input />").attr("type", "hidden").attr("name", "redScoreJson").attr("value", redScoreJson).appendTo("form");
$("<input />").attr("type", "hidden").attr("name", "blueScoreJson").attr("value", blueScoreJson).appendTo("form");
$("<input />").attr("type", "hidden").attr("name", "matchResultJson").attr("value", matchResultJson).appendTo("form");
return true;
});