fix(practice): reset of a running open practice restarts its clock from zero (1.70.3)

This commit is contained in:
larssand committed 2026-11-06 15:12:56 +01:00
1 parent 8f748d21df
commit 5323444679
5 files changed
+15 -4

No files matched your search

+5
View File
@@ -8,6 +8,11 @@ The application version is maintained in `package.json` and displayed in the adm
No changes recorded yet.
## 1.70.3
### Fixed
- Open practice: "Reset – new practice day" restarts the clock from 0:00; it kept counting from the first start.
## 1.70.2
### Fixed
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "rc-racecore",
"version": "1.70.2",
"version": "1.70.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "rc-racecore",
"version": "1.70.2",
"version": "1.70.3",
"hasInstallScript": true,
"dependencies": {
"better-sqlite3": "^12.11.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "rc-racecore",
"version": "1.70.2",
"version": "1.70.3",
"private": true,
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
"engines": {
+4
View File
@@ -608,6 +608,10 @@ function resetSessionData(session) {
// the server's live-results protection when the reset came right after the last lap.
ensureSessionResult(session.id);
Object.assign(session, { status: "ready", startedAt: null, endedAt: null, finishedByTimer: false, pausedAt: null, totalPausedMs: 0, followUpPausedMs: 0, audioAnnouncements: [] });
} else if (["running", "paused"].includes(session.status)) {
// A practice that keeps running: its clock starts again from zero (a paused one stays paused at 0:00).
const now = Date.now();
Object.assign(session, { startedAt: now, pausedAt: session.status === "paused" ? now : null, totalPausedMs: 0, followUpPausedMs: 0, audioAnnouncements: [] });
}
lastFinishAnnouncementSessionId = null;
delete lastOverlayLeaderKeyBySession[session.id];
+3 -1
View File
@@ -50,9 +50,11 @@ export async function runPracticeResetSmoke({ evaluate, navigate, savedState, wa
await waitFor(async () => ((await savedState()).resultsBySession?.[practice.id]?.passings || []).length === 0, "timing data cleared");
assert.deepEqual((await driverLaps()).sort(), [19000, 19500, 20000], "laps kept right after the reset");
assert.equal((await savedState()).sessions.find((session) => session.id === practice.id).status, "running", "the practice keeps running");
assert.ok((await savedState()).sessions.find((session) => session.id === practice.id).startedAt > startedAt + 500000, "the practice clock starts again from zero");
await waitFor(async () => evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "decoder connected");
decoder.sendPassing("8220001");
// The clock restarted at the reset, so the first lap is measured from there: a car crossing 20 s later.
decoder.sendPassing("8220001", Date.now() + 20000);
await waitFor(async () => ((await savedState()).resultsBySession?.[practice.id]?.passings || []).length >= 1, "a new lap after the reset");
await waitFor(async () => (await driverLaps()).length === 4, "the new lap joins the training stats");
assert.deepEqual((await driverLaps()).slice(0, 3), [20000, 19500, 19000], "the laps from before the reset are still there");