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

+3 -3
View File
@@ -174,7 +174,7 @@ test("practice on a fresh pack: no personal best calls for the first ten laps, t
assert.equal(Object.values(harness.state.resultsBySession.session_1.competitors)[0].bestLapMs, 20_500, "but it is still the best lap");
});
test("practice: a shortcut lap is flagged suspect - counted, but no best lap, personal best or record", () => {
test("practice: a shortcut lap is flagged suspect - it counts (also as best lap) until removed, but is never called out", () => {
const harness = createHarness({ sessionType: "open_practice" });
const entry = () => Object.values(harness.state.resultsBySession.session_1.competitors)[0];
let ts = 1_000;
@@ -186,9 +186,9 @@ test("practice: a shortcut lap is flagged suspect - counted, but no best lap, pe
const last = harness.state.resultsBySession.session_1.passings.at(-1);
assert.equal(last.suspect, true);
assert.equal(entry().laps, 7, "still counted as a lap");
assert.equal(entry().bestLapMs, 19_800, "not a best lap");
assert.equal(entry().bestLapMs, 15_000, "it counts until someone removes it");
assert.equal(harness.audioEvents.filter((event) => event === "personal_best").length, pbsBefore, "no personal best call for it");
ts += 15_100; // a second shortcut in a row is flagged too (suspect laps aren't the reference)
ts += 15_100; // a second shortcut in a row is flagged too (one lap hardly moves the median)
harness.passing(ts, "main");
assert.equal(harness.state.resultsBySession.session_1.passings.at(-1).suspect, true);
assert.ok(harness.overlayEvents.some((event) => event.type === "suspect"), "the overlay event feed shows it");