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
@@ -8,6 +8,11 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.89.45 - 2026-11-16
|
||||
|
||||
- Dashboard: Schedule drift only counts today's timed heats. Open Practice and free practice no longer count, so an open practice left running, or last weekend's race, no longer shows as hours behind schedule.
|
||||
- Race Setup wizard, step 3: the practice box no longer says "not used for seeding" (that is free practice). It now explains that these are timed practice heats for the entered drivers that can seed qualifying, and the count field says how many rounds are created.
|
||||
|
||||
## 1.89.44 - 2026-11-16
|
||||
|
||||
- Guide and README: the local Piper voice is marked as recommended, and the docs now say to press Pre-generate phrases and driver names again after adding drivers or changing a pronunciation name, voice or speed (existing lines are skipped). A name that is not pre-generated is made the first time it is said, with the browser voice as a one-off fallback if that is slow.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.44",
|
||||
"version": "1.89.45",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.44",
|
||||
"version": "1.89.45",
|
||||
"hasInstallScript": true,
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.44",
|
||||
"version": "1.89.45",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
|
||||
@@ -2169,6 +2169,8 @@ const TRANSLATIONS = {
|
||||
"events.wizard_create": "Skapa race",
|
||||
"events.wizard_use_practice": "Skapa practice-sessioner",
|
||||
"events.wizard_practice_sessions": "Antal practice-sessioner",
|
||||
"events.wizard_practice_hint": "Tidtagna practice-heat i racet med de anmälda förarna (masstart, samma längd som kvalet). Resultatet kan seeda kvalet: Hantera → Skapa kval från practice. Inte samma sak som Open Practice / fri träning.",
|
||||
"events.wizard_practice_count_hint": "Hur många practice-omgångar som skapas. Gäller bara om rutan till vänster är ikryssad.",
|
||||
"events.wizard_use_qualifying": "Skapa kvalomgångar",
|
||||
"events.wizard_qualifying_rounds": "Antal kvalomgångar",
|
||||
"events.wizard_use_team_race": "Skapa endurance / Team Race-session",
|
||||
@@ -4592,6 +4594,8 @@ const TRANSLATIONS = {
|
||||
"events.wizard_create": "Create race",
|
||||
"events.wizard_use_practice": "Create practice sessions",
|
||||
"events.wizard_practice_sessions": "Practice session count",
|
||||
"events.wizard_practice_hint": "Timed practice heats in the race with the entered drivers (mass start, same length as qualifying). The result can seed qualifying: Manage → Generate qualifying from practice. Not the same as Open Practice / free practice.",
|
||||
"events.wizard_practice_count_hint": "How many practice rounds are created. Only used when the box on the left is ticked.",
|
||||
"events.wizard_use_qualifying": "Create qualifying rounds",
|
||||
"events.wizard_qualifying_rounds": "Qualifying rounds",
|
||||
"events.wizard_use_team_race": "Create endurance / Team Race session",
|
||||
|
||||
+11
-4
@@ -25,14 +25,21 @@ import { isPracticeSessionType } from "./track_layouts_logic.js";
|
||||
import { renderTrackLayoutBar, bindTrackLayoutBar } from "./track_layout_bar.js";
|
||||
import { openHouseOfRcDriverImport, lookupHouseOfRcTransponders } from "./houseofrc_view.js";
|
||||
|
||||
function getScheduleDriftSummary(state) {
|
||||
const scheduledSessions = state.sessions
|
||||
.filter((session) => Number(session.startedAt || 0) > 0)
|
||||
// Open/free practice has no planned length, so it never counts: an open practice left running
|
||||
// would otherwise grow the drift for as long as the computer is on.
|
||||
const UNSCHEDULED_SESSION_TYPES = new Set(["open_practice", "free_practice"]);
|
||||
|
||||
// Today's timed sessions only (planned length vs. how long they actually took). Earlier days
|
||||
// don't count, so last weekend's race doesn't show as hours behind.
|
||||
export function getScheduleDriftSummary(state, nowTs = Date.now()) {
|
||||
const dayStart = new Date(nowTs);
|
||||
dayStart.setHours(0, 0, 0, 0);
|
||||
const scheduledSessions = (state.sessions || [])
|
||||
.filter((session) => Number(session.startedAt || 0) >= dayStart.getTime() && !UNSCHEDULED_SESSION_TYPES.has(session.type))
|
||||
.sort((left, right) => Number(left.startedAt || 0) - Number(right.startedAt || 0));
|
||||
if (!scheduledSessions.length) {
|
||||
return null;
|
||||
}
|
||||
const nowTs = Date.now();
|
||||
const plannedMs = scheduledSessions.reduce(
|
||||
(sum, session) => sum + Math.max(1, Number(session.durationMin || 0) || 0) * 60000 + Math.max(0, Number(session.followUpSec || 0) || 0) * 1000,
|
||||
0
|
||||
|
||||
@@ -140,12 +140,12 @@ export function renderRaceWizardContent(draft, classOptions, wizardDrivers, pres
|
||||
<form id="raceWizardPlanForm" class="form-grid cols-2">
|
||||
<label class="field-card">
|
||||
<span class="field-label">${t("events.wizard_use_practice")}</span>
|
||||
<span class="field-hint">${t("events.free_practice_note")}</span>
|
||||
<span class="field-hint">${t("events.wizard_practice_hint")}</span>
|
||||
<label class="toggle"><input type="checkbox" name="createPractice" ${draft.createPractice ? "checked" : ""} /><span>${t("events.wizard_use_practice")}</span></label>
|
||||
</label>
|
||||
<label class="field-card">
|
||||
<span class="field-label">${t("events.wizard_practice_sessions")}</span>
|
||||
<span class="field-hint">${t("events.practice_standings")}</span>
|
||||
<span class="field-hint">${t("events.wizard_practice_count_hint")}</span>
|
||||
<input type="number" min="0" step="1" name="practiceSessions" value="${draft.practiceSessions}" ${draft.createPractice ? "" : "disabled"} />
|
||||
</label>
|
||||
${!isEndurance ? `
|
||||
|
||||
@@ -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