Created
May 28, 2019 15:01
-
-
Save rjriel/c68f68a4059121f4d0e67331b9e9ddb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const layout = await model.getLayout() | |
const matrix = layout.qHyperCube.qDataPages[0].qMatrix[0] | |
const edgingValue = | |
checkNan(matrix[6].qNum) > 0 | |
? -checkNan(matrix[6].qNum) | |
: checkNan(matrix[7].qNum) | |
const lastEdgingValue = | |
checkNan(matrix[11].qNum) > 0 | |
? -checkNan(matrix[11].qNum) | |
: checkNan(matrix[12].qNum) | |
const newValues = { | |
speed: checkNan(matrix[0].qNum), | |
gates: checkNan(matrix[1].qNum), | |
totalGates: `/${checkNan(matrix[2].qNum)}`, | |
time: moment(checkNan(matrix[3].qNum)).format("mm:ss.SSS"), | |
status: matrix[4].qText, | |
errors: checkNan(matrix[5].qNum), | |
edging: edgingValue, | |
lastEdging: lastEdgingValue, | |
course: matrix[8].qText, | |
latitude: checkNan(matrix[9].qNum), | |
longitude: checkNan(matrix[10].qNum) | |
} | |
setValues(newValues) | |
if (newValues.status === "FIN" || newValues.status === "DNF") { | |
setRaceFinished(true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment