fix(training): keep practice laps in training stats after Reset data

Resetting a running Open Practice deleted its results, the Timing view
recreated an empty result at once, and the next save rebuilt that
session's training laps from nothing - wiping every earlier lap from
the drivers' stats. Reset now syncs first and records resultsResetAt;
laps from before it are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Opus 5.5 committed 2026-10-03 23:13:58 +02:00
1 parent 8b63dd2372
commit 3cc4fa0845
10 files changed
+141 -7

No files matched your search

+5
View File
@@ -380,6 +380,7 @@ export function renderTimingView(deps) {
getQuickAddDraft, setQuickAddDraft, getPassingValidationLabel, isCountedPassing, getCompetitorPassings,
getManualCorrectionSummary, formatTeamActiveMemberLabel, formatRaceClock, renderSessionChannelAnalysis,
setLastFinishAnnouncementSessionId, lastOverlayLeaderKeyBySession, lastOverlayTop3BySession, overlayEvents, setOverlayEvents, sessionReplay,
syncTrainingLedger = () => {},
} = deps;
const helperDeps = {
@@ -787,6 +788,10 @@ export function renderTimingView(deps) {
if (!confirm(t("timing.clear_confirm"))) {
return;
}
// Every lap so far goes into the training stats first; resultsResetAt then keeps them
// there although they leave this session's results (see syncTrainingLedger).
syncTrainingLedger();
session.resultsResetAt = Date.now();
delete state.resultsBySession[session.id];
session.followUpStartedAt = null;
setLastFinishAnnouncementSessionId(null);