fix(practice): stop flagging a driver's faster pace as suspect laps (1.42.5)

Flagged laps never entered the reference pace, so a driver who got
faster had every lap flagged. They now count in the reference (last 10
laps), settled flags are released, and a flagged lap counts until it is
removed; Approve only drops the flag.
This commit is contained in:
larssand committed 2026-10-25 21:20:17 +01:00
1 parent 35eb3eb059
commit 2c2b16537e
13 files changed
+132 -47

No files matched your search

+5 -3
View File
@@ -99,18 +99,20 @@ test("any lap can be removed, restored or (if suspect) approved - each logged an
assert.equal(harness.row.laps, 3);
assert.equal(harness.row.bestLapMs, 16000);
// A suspect lap doesn't count for best lap until approved; undo makes it suspect again.
// A suspect lap counts (also as best lap) until removed; approve only drops the flag, and
// undo puts the flag back.
harness.result.passings[2].lapMs = 12000;
harness.result.passings[2].suspect = true;
harness.deps.recalculateCompetitorFromPassings(harness.session, "driver_1");
assert.equal(harness.row.bestLapMs, 16000);
assert.equal(harness.row.bestLapMs, 12000);
assert.equal(act(50500, "approve"), true);
assert.equal(harness.result.passings[2].suspect, false);
assert.equal(harness.row.bestLapMs, 12000);
const approval = harness.result.adjustments.at(-1);
assert.equal(approval.category, "invalid");
assert.equal(undoJudgingAdjustment(harness.session, approval.id, { ...harness.deps, findPassingByUndoMarker: (session, key, ts) => harness.result.passings.find((passing) => passing.competitorKey === key && passing.timestamp === ts) }), true);
assert.equal(harness.result.passings[2].suspect, true);
assert.equal(harness.row.bestLapMs, 16000);
assert.equal(harness.row.bestLapMs, 12000);
assert.equal(act(99999, "remove"), false, "unknown lap");
assert.equal(act(17000, "explode"), false, "unknown action");
});