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

+11
View File
@@ -530,7 +530,14 @@ const renderBoard = () => {
// --- Race Day as the place where things are run --------------------------------------
// "New practice day": clears the session's laps on Timing for a new day; every lap so far
// is first put in the training stats, where resultsResetAt keeps it (see syncTrainingLedger).
// The session as it is in state now. A background refresh from the server replaces every
// session object without redrawing the page, so a button may still hold an old copy; changing
// that copy would change nothing (e.g. Run again left the clock at 4:32).
function currentSession(session) {
return (session && state.sessions.find((item) => item.id === session.id)) || session;
}
function resetSessionData(session) {
session = currentSession(session);
if (!session) return false;
syncTrainingLedger();
session.resultsResetAt = Date.now();
@@ -5627,6 +5634,7 @@ function saveState(options = {}) {
}
async function startOperationalSession(session, callbacks = {}) {
session = currentSession(session);
if (!session) return { ok: false, message: t("race_day.start_failed") };
const { requirePreflight = false, onTone, ...sequenceCallbacks } = callbacks;
if (session.mode === "track") {
@@ -5709,6 +5717,7 @@ function saveOperationalLapWindow(session, minLapSec, maxLapSec) {
}
function finishOperationalSession(session) {
session = currentSession(session);
if (!session) return false;
cancelRaceStart();
state.activeSessionId = session.id;
@@ -5722,6 +5731,7 @@ function finishOperationalSession(session) {
}
function pauseOperationalSession(session) {
session = currentSession(session);
if (!pauseSessionControl(session)) return false;
triggerRaceAudio("race_paused", { interrupt: true, force: true, logData: { raceId: session.eventId, sessionId: session.id } });
saveState();
@@ -5730,6 +5740,7 @@ function pauseOperationalSession(session) {
}
function resumeOperationalSession(session) {
session = currentSession(session);
if (!resumeSessionControl(session)) return false;
triggerRaceAudio("race_resumed", { interrupt: true, force: true, logData: { raceId: session.eventId, sessionId: session.id } });
saveState();
+2 -1
View File
@@ -129,7 +129,8 @@ export function getSessionTiming(session, nowTs = Date.now(), { getSessionTarget
return {
targetMs,
elapsedMs,
remainingMs: targetMs === null ? null : Math.max(0, targetMs - elapsedMs),
// Before the start the clock shows the time set for the heat (5:00), not the release extension.
remainingMs: targetMs === null ? null : !startedAt ? baseTargetMs : Math.max(0, targetMs - elapsedMs),
untimed: targetMs === null,
followUpActive,
followUpRemainingMs,