Skip to content

Instantly share code, notes, and snippets.

@rjriel
Created May 28, 2019 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjriel/c68f68a4059121f4d0e67331b9e9ddb9 to your computer and use it in GitHub Desktop.
Save rjriel/c68f68a4059121f4d0e67331b9e9ddb9 to your computer and use it in GitHub Desktop.
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