fix(race-day): run again resets the current heat, not a stale copy; show the set time before the start (1.54.2)

This commit is contained in:
larssand committed 2026-11-03 08:46:51 +01:00
1 parent 8b625c3d64
commit a8996c4195
7 files changed
+32 -4

No files matched your search

+4
View File
@@ -58,12 +58,16 @@ export async function runRaceDayQuickSmoke({ evaluate, navigate, savedState, wai
await evaluate(`(() => { const select = document.getElementById("raceDaySessionSelect"); select.value = "rq_done"; select.dispatchEvent(new Event("change")); })()`);
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayResetSession")`)), "Run again for the finished heat");
assert.equal(await evaluate(`document.getElementById("raceDayResetSession").textContent.trim()`), "↻ Run again");
// The page refreshes its data from the server every 15 s without redrawing; Run again must
// still reset the heat itself, not an old copy of it (the clock used to stay at 4:32).
await new Promise((resolve) => setTimeout(resolve, 16000));
await evaluate(`document.getElementById("raceDayResetSession").click()`);
await waitFor(async () => (await savedState()).sessions.find((session) => session.id === "rq_done")?.status === "ready", "the heat is ready to run again");
const reset = (await savedState()).sessions.find((session) => session.id === "rq_done");
assert.deepEqual([reset.startedAt || null, reset.endedAt || null, reset.finishedByTimer], [null, null, false], "the clock is back at zero");
assert.equal((await savedState()).resultsBySession.rq_done?.passings?.length || 0, 0, "its laps are cleared");
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayStart")`)), "Start is offered again");
assert.equal(await evaluate(`document.querySelector("[data-race-day-clock]").textContent.trim()`), "05:00", "the clock shows the full time again");
console.log("PASS a finished heat can be picked and reset: clock to zero, laps cleared, Start again");
// The race controller follows the heat on Race Day: order, laps, last/best lap, estimate.
+5
View File
@@ -620,6 +620,11 @@ test("session timing handles untimed practice, countdown, and follow-up", () =>
assert.equal(untimed.untimed, true);
assert.equal(untimed.remainingMs, null);
assert.equal(untimed.elapsedMs, 60000);
// A staggered heat not (yet / again) started shows the time set for it, not the release extension.
const staggered = { type: "qualification", durationMin: 5, startMode: "staggered", staggerGapSec: 3, manualGridIds: ["a", "b", "c", "d", "e", "f"] };
assert.equal(getSessionTiming(staggered, 5000, { getSessionTargetMs: getTarget }).remainingMs, 300000);
assert.equal(getSessionTiming({ ...staggered, startedAt: 1000 }, 1000, { getSessionTargetMs: getTarget }).remainingMs, 315000, "the running clock keeps the extension");
});
// Regression coverage for the user's report: a staggered-start qualifying heat with 4