fix(dashboard): schedule drift counts only today's timed heats; clearer practice texts in the race wizard (1.89.45)
This commit is contained in:
1 parent
d07d4477b7
commit
ce86f771c3
8 files changed
+51
-9
No files matched your search
@@ -38,6 +38,7 @@ import "./public_training_profile.test.js";
|
||||
import "./race_timing_logic.test.js";
|
||||
import "./track_layouts_logic.test.js";
|
||||
import "./race_day_logic.test.js";
|
||||
import "./schedule_drift.test.js";
|
||||
import "./race_day_export.test.js";
|
||||
import "./backup_service.test.js";
|
||||
import "./judging_logic.test.js";
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { getScheduleDriftSummary } from "../src/core_views.js";
|
||||
|
||||
const now = new Date(2026, 10, 16, 21, 0, 0).getTime();
|
||||
const min = 60000;
|
||||
|
||||
test("schedule drift: nothing started today shows no drift", () => {
|
||||
const lastWeek = now - 3 * 24 * 60 * min;
|
||||
const state = { sessions: [{ type: "qualification", durationMin: 5, startedAt: lastWeek, endedAt: lastWeek + 6 * min, status: "finished" }] };
|
||||
assert.equal(getScheduleDriftSummary(state, now), null);
|
||||
});
|
||||
|
||||
test("schedule drift: a running open practice never counts", () => {
|
||||
const state = { sessions: [{ type: "open_practice", durationMin: 0, startedAt: now - 130 * min, status: "running" }] };
|
||||
assert.equal(getScheduleDriftSummary(state, now), null);
|
||||
});
|
||||
|
||||
test("schedule drift: today's timed heats are compared with their planned length", () => {
|
||||
const state = { sessions: [
|
||||
{ type: "qualification", durationMin: 5, startedAt: now - 60 * min, endedAt: now - 53 * min, status: "finished" },
|
||||
{ type: "free_practice", durationMin: 0, startedAt: now - 120 * min, endedAt: now - 70 * min, status: "finished" },
|
||||
] };
|
||||
assert.deepEqual(getScheduleDriftSummary(state, now), { plannedMs: 5 * min, actualMs: 7 * min, driftMs: 2 * min });
|
||||
});
|
||||
Reference in new issue
Block a user