Fix lap limits and five-minute stint statistics
This commit is contained in:
1 parent
f561dd8feb
commit
483a9dbd5a
14 files changed
+356
-110
No files matched your search
@@ -408,12 +408,13 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
||||
const { minLapMs, maxLapMs } = getSessionLapWindow(session);
|
||||
let validLap = true;
|
||||
let invalidReason = "";
|
||||
let validationWarning = "";
|
||||
if (minLapMs > 0 && lapMs > 0 && lapMs < minLapMs) {
|
||||
validLap = false;
|
||||
invalidReason = "below_min";
|
||||
} else if (Number.isFinite(maxLapMs) && maxLapMs > 0 && lapMs > maxLapMs) {
|
||||
validLap = false;
|
||||
invalidReason = "above_max";
|
||||
// A long lap remains part of the race result, but starts a new statistics stint.
|
||||
validationWarning = "above_max_stint";
|
||||
}
|
||||
|
||||
const passing = {
|
||||
@@ -432,6 +433,9 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
||||
lapMs,
|
||||
validLap,
|
||||
invalidReason,
|
||||
validationWarning,
|
||||
excludedFromPace: validationWarning === "above_max_stint",
|
||||
stintBoundary: validationWarning === "above_max_stint",
|
||||
strength: msg.strength,
|
||||
loopId: String(msg.loop_id || ""),
|
||||
resend: Boolean(msg.resend),
|
||||
@@ -439,9 +443,6 @@ export function processDecoderMessageHelper(msg, deps, decoderRole = "main") {
|
||||
|
||||
if (!validLap) {
|
||||
result.passings.push(passing);
|
||||
if (invalidReason === "above_max") {
|
||||
entry.lastTimestamp = timestamp;
|
||||
}
|
||||
persistPassingToBackend(session.id, passing);
|
||||
saveState();
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user