fix(practice): reset of a running open practice restarts its clock from zero (1.70.3)
This commit is contained in:
1 parent
8f748d21df
commit
5323444679
5 files changed
+15
-4
No files matched your search
@@ -8,6 +8,11 @@ The application version is maintained in `package.json` and displayed in the adm
|
|||||||
|
|
||||||
No changes recorded yet.
|
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
|
## 1.70.2
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.70.2",
|
"version": "1.70.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.70.2",
|
"version": "1.70.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^12.11.1",
|
"better-sqlite3": "^12.11.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.70.2",
|
"version": "1.70.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -608,6 +608,10 @@ function resetSessionData(session) {
|
|||||||
// the server's live-results protection when the reset came right after the last lap.
|
// the server's live-results protection when the reset came right after the last lap.
|
||||||
ensureSessionResult(session.id);
|
ensureSessionResult(session.id);
|
||||||
Object.assign(session, { status: "ready", startedAt: null, endedAt: null, finishedByTimer: false, pausedAt: null, totalPausedMs: 0, followUpPausedMs: 0, audioAnnouncements: [] });
|
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;
|
lastFinishAnnouncementSessionId = null;
|
||||||
delete lastOverlayLeaderKeyBySession[session.id];
|
delete lastOverlayLeaderKeyBySession[session.id];
|
||||||
|
|||||||
@@ -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");
|
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.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.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");
|
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 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");
|
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");
|
assert.deepEqual((await driverLaps()).slice(0, 3), [20000, 19500, 19000], "the laps from before the reset are still there");
|
||||||
|
|||||||
Reference in new issue
Block a user