feat(race-day): day schedule for all classes, autopilot, pause the day, printed running order and drivers' board (1.50.0)

This commit is contained in:
larssand committed 2026-11-01 22:06:59 +01:00
1 parent 0ba858d638
commit fdc6c179dc
18 files changed
+735 -20

No files matched your search

+9 -11
View File
@@ -771,7 +771,12 @@ export function generateQualifyingForRace(event, { buildPracticeStandings, getEv
// manualOrder (event.sessionOrder, set with ▲▼ in Race Setup) overrides it for the sessions it
// lists; a session made later keeps its own place, e.g. a recreated Q1 H2 after Q1 H1.
export function orderSessionsForRunning(sessions = [], manualOrder = []) {
const auto = orderSessionsAutomatically(sessions);
return applyManualOrder(orderSessionsAutomatically(sessions), manualOrder);
}
// The ids in manualOrder take the slots those sessions have in the automatic order, in the
// listed order; every other session keeps its automatic slot.
export function applyManualOrder(auto = [], manualOrder = []) {
const byId = new Map(auto.map((session) => [session.id, session]));
const listed = [...new Set(manualOrder || [])].filter((id) => byId.has(id)).map((id) => byId.get(id));
if (!listed.length) return auto;
@@ -1090,21 +1095,14 @@ export function applyBumpsForRace(event, { buildFinalStandings, getSessionsForEv
// of the original plan - a heat that started late or ran long (including any pause; a
// paused session's real endedAt already reflects the full wall-clock time it took)
// automatically pushes the rest of the day forward, with no separate "reschedule" step.
export function buildEventSchedule(event, sessions, { getSessionSortWeight }) {
export function buildEventSchedule(event, sessions) {
const scheduleStartAt = Number(event?.raceConfig?.scheduleStartAt || 0) || null;
if (!scheduleStartAt) {
return [];
}
const gapMs = Math.max(0, Number(event?.raceConfig?.scheduleGapMin ?? 3) || 0) * 60000;
const ordered = [...sessions]
.filter((session) => session.mode === "race")
.sort((left, right) => {
const weightDiff = getSessionSortWeight(left) - getSessionSortWeight(right);
if (weightDiff !== 0) {
return weightDiff;
}
return String(left.name || "").localeCompare(String(right.name || ""));
});
// The same running order as Race Setup and Race Day (▲▼ included).
const ordered = orderSessionsForRunning(sessions.filter((session) => session.mode === "race"), event?.sessionOrder);
let cursor = scheduleStartAt;
return ordered.map((session) => {