feat(day): marshals per heat from the heat before or after, on the schedule, board, printout and heat call (1.89.30)

This commit is contained in:
larssand committed 2026-11-14 16:26:53 +01:00
1 parent 2db77fe6cd
commit 163e82224c
10 files changed
+72 -13

No files matched your search

+23 -3
View File
@@ -13,7 +13,7 @@ import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologu
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
import { flagHtml, driverCountryCode, countryChoices, setDriverCountryResolver, rowFlag } from "./country_flags.js";
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay, refreshRaceDayLive } from "./race_day_view.js";
import { normalizeRaceDays, getRaceDay, upsertRaceDay, orderDaySessions, buildDaySchedule, getAutopilotAction, moveInDayOrder, pickBoardDate, getDueCall, withRaceSetupStart, eventScheduleFromDayRows } from "./day_schedule_logic.js";
import { assignMarshals, normalizeRaceDays, getRaceDay, upsertRaceDay, orderDaySessions, buildDaySchedule, getAutopilotAction, moveInDayOrder, pickBoardDate, getDueCall, withRaceSetupStart, eventScheduleFromDayRows } from "./day_schedule_logic.js";
import { buildRaceOverview, buildRaceOverviewCsvRows, withQualifyingPlaces, qualifyingPlaces } from "./race_overview_logic.js";
import { renderRaceOverviewPanel, bindRaceOverviewPanel } from "./race_overview_view.js";
import { renderSpeakerPanel, bindSpeakerPanel } from "./speaker_panel_view.js";
@@ -515,7 +515,8 @@ const getDayClassLabel = (session) => { const event = state.events.find((item) =
function buildDayRows(date, now = Date.now()) {
const day = getDayPlan(date);
const ordered = orderDaySessions({ events: state.events, sessions: state.sessions, date, manualOrder: day.sessionOrder });
return buildDaySchedule(ordered, day, now).map((row) => ({ ...row, driverCount: getSessionGridEntries(row.session).length }));
const rows = buildDaySchedule(ordered, day, now).map((row) => ({ ...row, driverCount: getSessionGridEntries(row.session).length }));
return assignMarshals(rows, day.marshalRule, (session) => getSessionGridEntries(session));
}
// Race Day works on the date of the session in focus, else today.
const getRaceDayDate = () => {
@@ -582,12 +583,19 @@ function callHeat(sessionId) {
variables: {
heat: `${getDayClassLabel(session)} ${session.name}`.trim(),
minutes: Math.max(1, Math.round(((row?.start || Date.now()) - Date.now()) / 60000)),
drivers: buildHeatCallDrivers(session),
drivers: buildHeatCallDrivers(session) + buildHeatCallMarshals(row),
},
logData: { raceId: session.eventId, sessionId: session.id },
});
renderView();
}
// "Marshals: Roy, Eddie. " after the drivers when the day has a marshal rule (spoken names).
function buildHeatCallMarshals(row) {
const names = (row?.marshals || []).map((entry) => { const driver = state.drivers.find((item) => item.id === entry.driverId); return String(driver?.speechName || driver?.name || entry.name || "").trim(); }).filter(Boolean);
if (!names.length) return "";
// Same shape as the drivers part ("Drivers: Roy, Eddie. "), which the call template follows directly.
return `${normalizeRaceAudioSettings(state.settings.raceAudio).language === "en" ? "Marshals" : "Marshaler"}: ${names.join(", ")}. `;
}
// "Drivers: Roy, Eddie. " in the announcer's language (not the page's), with each driver's
// spoken name; drivers that can't be found are left out rather than read as "unknown driver".
// Grid order, so "Bil 3" is the third grid slot even when a driver can't be found.
@@ -3513,6 +3521,12 @@ const TRANSLATIONS = {
"day.next": "Nästa",
"day.call_min": "Upprop (min innan)",
"day.call_title": "{name} startar {time} (om {min} min) – dags att ropa upp",
"day.marshal_rule": "Marshals",
"day.marshal_off": "Av",
"day.marshal_previous": "Förra heatets förare",
"day.marshal_next": "Nästa heats förare",
"day.col_marshals": "Marshals",
"day.marshals": "🦺 Marshals: {names}",
"day.call_now": "Ropa ut",
"day.call_later": "Senare",
"day.called_at": "Uppropad {time}",
@@ -5858,6 +5872,12 @@ const TRANSLATIONS = {
"day.next": "Next",
"day.call_min": "Call (min before)",
"day.call_title": "{name} starts at {time} (in {min} min) – time to call it",
"day.marshal_rule": "Marshals",
"day.marshal_off": "Off",
"day.marshal_previous": "Drivers of the heat before",
"day.marshal_next": "Drivers of the heat after",
"day.col_marshals": "Marshals",
"day.marshals": "🦺 Marshals: {names}",
"day.call_now": "Call now",
"day.call_later": "Later",
"day.called_at": "Called {time}",