Skip to content

Commit

Permalink
Update CSV reading
Browse files Browse the repository at this point in the history
  • Loading branch information
KinuTheDragon committed Feb 10, 2024
1 parent b0ca757 commit 06149b3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ function updateScoutingData() {
else if (rawValue === "TRUE" || rawValue === "FALSE") value = rawValue === "TRUE";
obj[lines[0][i]] = value;
}
scoutingData.push(rawCsvToCleaned(obj));
scoutingData.push(rawCsvToCleaned(obj, lines[0]));
}
}
}

// CHANGE THIS WHEN THE CSV FORMAT CHANGES
function rawCsvToCleaned(obj) {
function rawCsvToCleaned(obj, headers) {
return {
canClimb: obj["Can climb?"],
canScoreAmp: obj["Can score amp?"],
canScoreSpeaker: obj["Can score speaker?"],
canScoreTrap: obj["Can score trap?"],
canShootTrap: obj["Can shoot trap?"],
cycleTime: obj["Cycle time (seconds)"],
shootTime: obj["Shoot time (seconds)"],
ampTime: obj["Amp time (seconds)"],
teamNumber: obj["Team number"]
teamNumber: obj[headers[0]],
cycleTime: obj[headers[1]],
shootTime: obj[headers[2]],
ampTime: obj[headers[3]],
canScoreAmp: obj[headers[4]],
canScoreSpeaker: obj[headers[5]],
canClimb: obj[headers[6]],
canScoreTrap: obj[headers[7]],
canShootTrap: obj[headers[8]]
};
}

Expand Down

0 comments on commit 06149b3

Please sign in to comment.