Dealt with an edge case
Dealt with an edge case where there are no strokes detected, but a number of impulses is recorded (Typically during first calibration).
This commit is contained in:
parent
65b273bbea
commit
97c1da96d6
|
|
@ -311,8 +311,12 @@ function createWorkoutRecorder () {
|
|||
function minimumRecordingTimeHasPassed () {
|
||||
const minimumRecordingTimeInSeconds = 10
|
||||
const rotationImpulseTimeTotal = rotationImpulses.reduce((acc, impulse) => acc + impulse, 0)
|
||||
const strokeTimeTotal = strokes[strokes.length - 1].totalMovingTime
|
||||
return (Math.max(rotationImpulseTimeTotal, strokeTimeTotal) > minimumRecordingTimeInSeconds)
|
||||
if (strokes.length > 0) {
|
||||
const strokeTimeTotal = strokes[strokes.length - 1].totalMovingTime
|
||||
return (Math.max(rotationImpulseTimeTotal, strokeTimeTotal) > minimumRecordingTimeInSeconds)
|
||||
} else {
|
||||
return (rotationImpulseTimeTotal > minimumRecordingTimeInSeconds)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue