feat(layouts): optional min/max lap time per track layout for practice
Each layout can carry its own lap window (set on creation, editable in Settings, saved from Race Day during practice). Open/Free practice on that layout uses it; races always keep the event's values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8601954ea2
commit
9d79bcb4d3
13 files changed
+174
-15
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { getLayoutLapWindowOverride } from "./track_layouts_logic.js";
|
||||
function unique(values) {
|
||||
return [...new Set(values.map((value) => String(value || "").trim()).filter(Boolean))];
|
||||
}
|
||||
@@ -68,8 +69,9 @@ export function buildRaceDayPreflight(state, session, { backendAvailable = false
|
||||
checks.push(check("pit_decoders", pitConnected ? "ok" : "warning"));
|
||||
}
|
||||
|
||||
const minLapMs = Math.max(0, Number(event?.raceConfig?.minLapMs || 0) || 0);
|
||||
const maxLapMs = Math.max(0, Number(event?.raceConfig?.maxLapMs || 0) || 0);
|
||||
const layoutOverride = getLayoutLapWindowOverride(state?.trackLayouts, session);
|
||||
const minLapMs = layoutOverride.minLapMs ?? Math.max(0, Number(event?.raceConfig?.minLapMs || 0) || 0);
|
||||
const maxLapMs = layoutOverride.maxLapMs ?? Math.max(0, Number(event?.raceConfig?.maxLapMs || 0) || 0);
|
||||
const validLapWindow = maxLapMs > minLapMs && minLapMs > 0;
|
||||
const openPractice = session.type === "open_practice";
|
||||
const lapWindowLevel = event?.mode !== "race" || validLapWindow ? "ok" : openPractice ? "warning" : "error";
|
||||
|
||||
Reference in new issue
Block a user