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
+4
-2
@@ -1,3 +1,4 @@
|
||||
import { getLayoutLapWindowOverride } from "./track_layouts_logic.js";
|
||||
export function getSessionTypeLabel(type, { t }) {
|
||||
const key = `session.${String(type || "").toLowerCase()}`;
|
||||
const translated = t(key);
|
||||
@@ -40,8 +41,9 @@ export function getSessionLapWindow(session, { state }) {
|
||||
if (event?.mode !== "race") {
|
||||
return { minLapMs: 0, maxLapMs: Number.POSITIVE_INFINITY };
|
||||
}
|
||||
const minLapMs = Math.max(0, Number(event?.raceConfig?.minLapMs || 0) || 0);
|
||||
const configuredMaxLapMs = Math.max(0, Number(event?.raceConfig?.maxLapMs || 60000) || 60000);
|
||||
const override = getLayoutLapWindowOverride(state.trackLayouts, session);
|
||||
const minLapMs = override.minLapMs ?? Math.max(0, Number(event?.raceConfig?.minLapMs || 0) || 0);
|
||||
const configuredMaxLapMs = override.maxLapMs ?? Math.max(0, Number(event?.raceConfig?.maxLapMs || 60000) || 60000);
|
||||
const maxLapMs = configuredMaxLapMs > 0 ? Math.max(configuredMaxLapMs, minLapMs || 0) : Number.POSITIVE_INFINITY;
|
||||
return { minLapMs, maxLapMs };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user