Skip to content

Commit

Permalink
Merge pull request #117 from Rich-Watson0126/dynamicRequiredFields
Browse files Browse the repository at this point in the history
Adding dynamic Required field handling from JSON
  • Loading branch information
fuddster authored Jan 14, 2025
2 parents 0bf0022 + a7258e2 commit 63324df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions resources/js/scoutingPASS.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ var options = {
quietZoneColor: '#FFFFFF'
};

// Must be filled in: e=event, m=match#, l=level(q,qf,sf,f), t=team#, r=robot(r1,r2,b1..), s=scouter
//var requiredFields = ["e", "m", "l", "t", "r", "s", "as"];
var requiredFields = ["e", "m", "l", "r", "s", "as"];
// Built from the JSON
var requiredFields = []; //["e", "m", "l", "r", "s", "as"];

function addTimer(table, idx, name, data) {
var row = table.insertRow(idx);
Expand Down Expand Up @@ -676,6 +675,12 @@ function addElement(table, idx, data) {
return idx
}

function buildRequiredElementList(element) {
if (element.required == "true") {
requiredFields.push(element.code);
}
}

function configure() {
try {
var mydata = JSON.parse(config_data);
Expand Down Expand Up @@ -737,6 +742,7 @@ function configure() {
var idx = 0;
pmc.forEach(element => {
idx = addElement(pmt, idx, element);
buildRequiredElementList(element);
});

// Configure auton screen
Expand Down

0 comments on commit 63324df

Please sign in to comment.