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:
1 parent
2db77fe6cd
commit
163e82224c
10 files changed
+72
-13
No files matched your search
@@ -8,6 +8,12 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.89.30 - 2026-11-14
|
||||
|
||||
### Added
|
||||
|
||||
- **Marshals** in Race Day's schedule (Off / Drivers of the heat before / Drivers of the heat after): shown per heat in the schedule, the printed running order and the drivers' board, and read out in the heat call after the drivers. A driver in the heat never marshals it.
|
||||
|
||||
## 1.89.29 - 2026-11-14
|
||||
|
||||
### Added
|
||||
|
||||
@@ -108,7 +108,7 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create
|
||||
- **A session picker** and the buttons that apply right now: Start, Pause, Resume, Finish, **↻ Run again** for a stopped or finished heat, qualifier or final (laps, results and clock reset), and for practice **Reset – new practice day**. Practice uses plain words and has no start lights. The picker lists today's races grouped per race (plus anything running); older races and other days' rounds are under **Show all sessions**.
|
||||
- **Live race** for the race controller, right under the clock while a heat, qualifier or final runs: the running order with laps, last lap, best lap, gap to the car ahead and to the leader, and the estimated finish (laps and time when the time is up). The heat's fastest lap is purple, a personal best on the last lap green, and a bar shows how far into the lap each car is (red = late). After the heat it shows the result.
|
||||
- The **heat queue** shows the current, next and after-next heat in running order: practice, qualifying round by round (Q1 H1, Q1 H2, Q2 H1 …), then finals from the lowest (C, B, A). When a heat is done, **▶ Next** selects the next one in one click. The session lists in Race Setup and on Race Day follow the same order, so a heat deleted and made again lands in its right place; **▲▼** on a session in Race Setup moves it earlier or later.
|
||||
- **Today's schedule** (at the bottom) puts every class raced that day in one running order with times: practice, then each qualifying round with the classes taking turns, then the finals. Set the first start, the break between heats, a longer **break between rounds** (practice → qualifying, round 1 → round 2) and a **break before the finals** (lunch, counted from the end of qualifying, so the finals don't start the moment they are created). **☕** on a heat adds an extra break before it. **Fixed breaks** at clock times (e.g. Lunch 12:00–13:00 and Prize-giving 16:00–16:30; **+ Add break** for more, ✕ removes one) keep every heat out of those times: a heat that would start or run into a break starts when it ends, and the printed running order and the drivers' board show the break. Empty round/finals breaks use the heat break. **▲▼** change the order. A heat that starts late, runs long or is paused moves the rest of the day. Heats already run fold into one line (✓ 6 heats run – show), and the next heat is marked.
|
||||
- **Today's schedule** (at the bottom) puts every class raced that day in one running order with times: practice, then each qualifying round with the classes taking turns, then the finals. Set the first start, the break between heats, a longer **break between rounds** (practice → qualifying, round 1 → round 2) and a **break before the finals** (lunch, counted from the end of qualifying, so the finals don't start the moment they are created). **☕** on a heat adds an extra break before it. **Fixed breaks** at clock times (e.g. Lunch 12:00–13:00 and Prize-giving 16:00–16:30; **+ Add break** for more, ✕ removes one) keep every heat out of those times: a heat that would start or run into a break starts when it ends, and the printed running order and the drivers' board show the break. Empty round/finals breaks use the heat break. **Marshals** (Off / Drivers of the heat before / Drivers of the heat after) shows who marshals each heat in the schedule, the printout and the drivers' board ("🦺 Marshals: …"), and the heat call reads them after the drivers; a driver in the heat itself never marshals it. **▲▼** change the order. A heat that starts late, runs long or is paused moves the rest of the day. Heats already run fold into one line (✓ 6 heats run – show), and the next heat is marked.
|
||||
- **🖨 Print running order** gives times, classes, heats and drivers for the board in the pits.
|
||||
- **📺 Drivers' board** (`/public-overlay/schedule`, also under Overlay) shows what is on track, the next three heats with their drivers, then the rest of the day. A heat that has been called is highlighted "Called – get ready". It works on a phone or a TV in the pits.
|
||||
- **Calling a heat:** when a heat is 10 minutes away (set under **Call**), Race Day asks the race controller: **📢 Call now** reads the heat and its drivers over the speakers and highlights it on the drivers' board; **Later** asks again in 2 minutes. With the autopilot on, heats are called on their own.
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ Gränssnittet finns på svenska och engelska.
|
||||
- **Snabbval** överst: **Starta träning** (fortsätt eller starta en Open Practice), **Ny banlayout** (under träning) och **Skapa race**. Översikten har samma tre vanliga uppgifter.
|
||||
- **En sessionsväljare** och de knappar som gäller just nu: Start, Pausa, Fortsätt, Avsluta, **↻ Kör om** för ett avbrutet eller klart heat, kval eller final (varv, resultat och klocka nollställs), och för träning **Nollställ – ny träningsdag**. Träning använder vanliga ord och har inga startljus. Väljaren visar dagens race grupperade per race (plus det som pågår); äldre race och andra dagars deltävlingar finns under **Visa alla sessioner**.
|
||||
- **Live-race** för race controllern, direkt under klockan medan ett heat, kval eller final pågår: ordningen med varv, senaste varv, bästa varv, avstånd till bilen före och till ledaren, och beräknat slut (varv och tid när tiden går ut). Heatets snabbaste varv är lila, personbästa på senaste varvet grönt, och en stapel visar hur långt in på varvet varje bil är (röd = sen). Efter heatet visas resultatet.
|
||||
- **Dagens schema** (längst ned) lägger alla klasser som körs den dagen i en körordning med tider: träning, sedan varje kvalomgång där klasserna turas om, sist finalerna. Ange första start, paus mellan heaten, en längre **paus mellan omgångar** (träning → kval, omgång 1 → omgång 2) och **paus före finaler** (lunch, räknas från att kvalet tog slut, så finalerna inte startar direkt när de skapas). **☕** på ett heat lägger in en extra paus före det. **Fasta pauser** med klockslag (t.ex. Lunch 12:00–13:00 och Prisutdelning 16:00–16:30; **+ Lägg till paus** för fler, ✕ tar bort) håller alla heat utanför de tiderna: ett heat som skulle starta i eller gå in i en paus startar när den är slut, och utskriften av körordningen och förartavlan visar pausen. Tomma fält för omgångar/finaler använder pausen mellan heat. **▲▼** ändrar ordningen. Ett heat som startar sent, drar ut på tiden eller pausas flyttar resten av dagen. Körda heat fälls ihop till en rad (✓ 6 heat körda – visa), och nästa heat är markerat.
|
||||
- **Dagens schema** (längst ned) lägger alla klasser som körs den dagen i en körordning med tider: träning, sedan varje kvalomgång där klasserna turas om, sist finalerna. Ange första start, paus mellan heaten, en längre **paus mellan omgångar** (träning → kval, omgång 1 → omgång 2) och **paus före finaler** (lunch, räknas från att kvalet tog slut, så finalerna inte startar direkt när de skapas). **☕** på ett heat lägger in en extra paus före det. **Fasta pauser** med klockslag (t.ex. Lunch 12:00–13:00 och Prisutdelning 16:00–16:30; **+ Lägg till paus** för fler, ✕ tar bort) håller alla heat utanför de tiderna: ett heat som skulle starta i eller gå in i en paus startar när den är slut, och utskriften av körordningen och förartavlan visar pausen. Tomma fält för omgångar/finaler använder pausen mellan heat. **Marshals** (Av / Förra heatets förare / Nästa heats förare) visar vilka som ska marshala varje heat i schemat, på utskriften och förartavlan ("🦺 Marshals: …"), och uppropet läser upp dem efter förarna; den som själv kör heatet blir aldrig marshal i det. **▲▼** ändrar ordningen. Ett heat som startar sent, drar ut på tiden eller pausas flyttar resten av dagen. Körda heat fälls ihop till en rad (✓ 6 heat körda – visa), och nästa heat är markerat.
|
||||
- **🖨 Skriv ut körordning** ger tider, klasser, heat och förare att sätta upp på tavlan i depån.
|
||||
- **📺 Förarvy** (`/public-overlay/schedule`, finns även under Overlay) visar vad som körs, de tre nästa heaten med förare, sedan resten av dagen. Ett uppropat heat markeras "Uppropad – gör dig redo". Den fungerar på mobilen eller en TV i depån.
|
||||
- **Upprop:** när ett heat har 10 minuter kvar (ändras under **Upprop**) frågar Race Day race controllern: **📢 Ropa ut** läser upp heatet och förarna i högtalarna och markerar det i förarvyn; **Senare** frågar igen om 2 minuter. När automatiken är på ropas heaten upp av sig själva.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.29",
|
||||
"version": "1.89.30",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.29",
|
||||
"version": "1.89.30",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.11.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.29",
|
||||
"version": "1.89.30",
|
||||
"private": true,
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
"engines": {
|
||||
|
||||
+23
-3
@@ -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}",
|
||||
|
||||
@@ -52,6 +52,8 @@ export function normalizeRaceDay(day = {}) {
|
||||
return { fixedBreaks, breakFrom: first?.from || null, breakTo: first?.to || null, breakLabel: first?.label || "" };
|
||||
})(),
|
||||
callMin: Number(day.callMin) > 0 ? Math.min(60, Number(day.callMin)) : DEFAULT_CALL_MIN,
|
||||
// Who marshals a heat: the drivers of the heat before it, of the one after it, or nobody set.
|
||||
marshalRule: ["previous", "next"].includes(day.marshalRule) ? day.marshalRule : "off",
|
||||
sessionOrder: [...new Set((Array.isArray(day.sessionOrder) ? day.sessionOrder : []).map(String).filter(Boolean))],
|
||||
autopilot: day.autopilot === true,
|
||||
pausedAt: Number(day.pausedAt) > 0 ? Number(day.pausedAt) : null,
|
||||
@@ -255,3 +257,15 @@ export function getDueCall(rows, { day, now = Date.now(), snoozedUntil = () => 0
|
||||
const callMs = Math.max(1, Number(day?.callMin || DEFAULT_CALL_MIN)) * 60000;
|
||||
return rows.find((row) => row.state === "upcoming" && !row.session.calledAt && row.start - now <= callMs && Number(snoozedUntil(row.session.id) || 0) <= now) || null;
|
||||
}
|
||||
|
||||
// Marshals per heat in the day's running order (classes taking turns included): rule "previous"
|
||||
// = the drivers of the heat before, "next" = of the heat after. A driver in the heat itself never
|
||||
// marshals it. entrantsOf(session) -> [{ driverId, name }]. Adds row.marshals ([] when off).
|
||||
export function assignMarshals(rows, rule, entrantsOf) {
|
||||
return rows.map((row, index) => {
|
||||
const source = rule === "previous" ? rows[index - 1] : rule === "next" ? rows[index + 1] : null;
|
||||
if (!source) return { ...row, marshals: [] };
|
||||
const driving = new Set(entrantsOf(row.session).map((entry) => String(entry.driverId)));
|
||||
return { ...row, marshals: entrantsOf(source.session).filter((entry) => entry.driverId && !driving.has(String(entry.driverId))) };
|
||||
});
|
||||
}
|
||||
@@ -24,6 +24,7 @@ export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopil
|
||||
// Run heats fold into one line so what is left of the day is on top.
|
||||
const doneCount = rows.filter((row) => row.state === "done").length;
|
||||
const nextId = rows.find((row) => row.state === "upcoming")?.session.id;
|
||||
const showMarshals = (day.marshalRule || "off") !== "off";
|
||||
return `
|
||||
<section class="panel mt-16 day-schedule" id="daySchedule">
|
||||
<div class="panel-header">
|
||||
@@ -44,6 +45,7 @@ export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopil
|
||||
${[...(day.fixedBreaks || []), { from: "", to: "", label: "" }].map((item) => fixedBreakRow(item, { t, escapeHtml })).join("")}
|
||||
<button class="btn btn-mini" type="button" data-fixed-break-add>+ ${escapeHtml(t("day.fixed_break_add"))}</button>
|
||||
</fieldset>
|
||||
<label>${escapeHtml(t("day.marshal_rule"))}<select name="marshalRule">${["off", "previous", "next"].map((value) => `<option value="${value}" ${(day.marshalRule || "off") === value ? "selected" : ""}>${escapeHtml(t("day.marshal_" + value))}</option>`).join("")}</select></label>
|
||||
<label>${escapeHtml(t("day.call_min"))}<input type="number" min="1" max="60" step="1" name="callMin" value="${escapeHtml(String(day.callMin))}" /></label>
|
||||
<button class="btn btn-primary btn-mini" type="submit">${escapeHtml(t("common.save"))}</button>
|
||||
</form>
|
||||
@@ -57,14 +59,15 @@ export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopil
|
||||
<span class="day-autopilot-status" data-autopilot-status>${escapeHtml(autopilotStatus || (day.autopilot && !autopilotHere ? t("day.autopilot_elsewhere") : ""))}</span>
|
||||
</div>
|
||||
<table class="day-schedule-table">
|
||||
<thead><tr><th>${escapeHtml(t("day.col_time"))}</th><th>${escapeHtml(t("day.col_session"))}</th><th>${escapeHtml(t("day.col_drivers"))}</th><th></th><th></th></tr></thead>
|
||||
<thead><tr><th>${escapeHtml(t("day.col_time"))}</th><th>${escapeHtml(t("day.col_session"))}</th><th>${escapeHtml(t("day.col_drivers"))}</th>${showMarshals ? `<th>${escapeHtml(t("day.col_marshals"))}</th>` : ""}<th></th><th></th></tr></thead>
|
||||
<tbody>
|
||||
${doneCount ? `<tr class="day-done-toggle"><td colspan="5"><button class="btn btn-mini" type="button" id="dayToggleDone">${escapeHtml(t(showDone ? "day.hide_done" : "day.show_done", { count: doneCount }))}</button></td></tr>` : ""}
|
||||
${doneCount ? `<tr class="day-done-toggle"><td colspan="${showMarshals ? 6 : 5}"><button class="btn btn-mini" type="button" id="dayToggleDone">${escapeHtml(t(showDone ? "day.hide_done" : "day.show_done", { count: doneCount }))}</button></td></tr>` : ""}
|
||||
${rows.map((row, index) => row.state === "done" && !showDone ? "" : `
|
||||
<tr class="is-${row.state} ${row.session.id === nextId ? "is-next" : ""} ${row.delayed ? "is-delayed" : ""}" data-day-row="${escapeHtml(row.session.id)}">
|
||||
<td><strong>${formatClockTime(row.start)}</strong>${row.delayed && row.state !== "done" ? ` <small class="day-planned">(${formatClockTime(row.plannedStart)})</small>` : ""}${row.afterBreak ? `<br><small class="day-break">${escapeHtml(fixedBreakText(row.afterBreak, t))}</small>` : row.breakMin > day.gapMin && index > 0 ? `<br><small class="day-break">☕ ${escapeHtml(t("day.break_before", { min: row.breakMin }))}</small>` : ""}</td>
|
||||
<td>${row.session.id === nextId ? `<span class="pill">${escapeHtml(t("day.next"))}</span> ` : ""}${escapeHtml(rowLabel(row, getClassLabel))}</td>
|
||||
<td>${row.driverCount ?? ""}</td>
|
||||
${showMarshals ? `<td><small>${escapeHtml(marshalNames(row))}</small></td>` : ""}
|
||||
<td><small>${escapeHtml(stateLabel(row, t, now))}</small></td>
|
||||
<td class="day-move">
|
||||
${row.state === "upcoming" ? `<button class="btn btn-mini ${day.breaks?.[row.session.id] ? "is-active" : ""}" type="button" data-day-break="${escapeHtml(row.session.id)}" title="${escapeHtml(t("day.add_break"))}">☕${day.breaks?.[row.session.id] ? ` ${day.breaks[row.session.id]}` : ""}</button>` : ""}
|
||||
@@ -122,7 +125,7 @@ export function bindDaySchedulePanel(root, { date, onSavePlan, onBreak = () => {
|
||||
const time = String(form.get("startTime") || "").trim();
|
||||
const startAt = time ? new Date(`${date}T${time}`).getTime() : null;
|
||||
const optional = (name) => (String(form.get(name) ?? "").trim() === "" ? null : Math.max(0, Number(form.get(name)) || 0));
|
||||
onSavePlan({ startAt: Number.isFinite(startAt) ? startAt : null, gapMin: Math.max(0, Number(form.get("gapMin")) || 0), roundGapMin: optional("roundGapMin"), finalsGapMin: optional("finalsGapMin"), fixedBreaks: [...event.currentTarget.querySelectorAll("[data-fixed-break]")].map((row) => ({ label: row.querySelector('[name="breakLabel"]').value, from: row.querySelector('[name="breakFrom"]').value, to: row.querySelector('[name="breakTo"]').value })).filter((item) => item.from && item.to), callMin: Math.max(1, Number(form.get("callMin")) || 10) });
|
||||
onSavePlan({ startAt: Number.isFinite(startAt) ? startAt : null, gapMin: Math.max(0, Number(form.get("gapMin")) || 0), roundGapMin: optional("roundGapMin"), finalsGapMin: optional("finalsGapMin"), fixedBreaks: [...event.currentTarget.querySelectorAll("[data-fixed-break]")].map((row) => ({ label: row.querySelector('[name="breakLabel"]').value, from: row.querySelector('[name="breakFrom"]').value, to: row.querySelector('[name="breakTo"]').value })).filter((item) => item.from && item.to), marshalRule: String(form.get("marshalRule") || "off"), callMin: Math.max(1, Number(form.get("callMin")) || 10) });
|
||||
});
|
||||
// Add / remove break rows in place (saved with the form).
|
||||
root.querySelector("[data-fixed-breaks]")?.addEventListener("click", (event) => {
|
||||
@@ -151,6 +154,9 @@ export function bindDaySchedulePanel(root, { date, onSavePlan, onBreak = () => {
|
||||
}
|
||||
|
||||
// For the board in the pits: time, class, session and the drivers in grid order.
|
||||
// "Roy, Anders" - who marshals the heat (row.marshals from assignMarshals).
|
||||
const marshalNames = (row) => (row.marshals || []).map((entry) => entry.name).join(", ");
|
||||
|
||||
// "🍽 Lunch 12:00–13:00" for the heat right after a fixed break (item = row.afterBreak).
|
||||
const fixedBreakText = (item, t) => `🍽 ${item?.label || t("day.fixed_break_default")} ${item?.from}–${item?.to}`;
|
||||
|
||||
@@ -177,7 +183,7 @@ export function buildDaySchedulePrintHtml({ t, escapeHtml, date, rows, getClassL
|
||||
<tbody>
|
||||
${rows.map((row) => `${row.afterBreak ? `<tr class="break"><td colspan="3"><strong>${escapeHtml(fixedBreakText(row.afterBreak, t))}</strong></td></tr>` : ""}<tr>
|
||||
<td class="time">${formatClockTime(row.start)}</td>
|
||||
<td class="session">${escapeHtml(rowLabel(row, getClassLabel))}</td>
|
||||
<td class="session">${escapeHtml(rowLabel(row, getClassLabel))}${row.marshals?.length ? `<br><small>${escapeHtml(t("day.marshals", { names: marshalNames(row) }))}</small>` : ""}</td>
|
||||
<td><ol>${getSessionGridEntries(row.session).map((entry) => `<li>${rowFlag(entry)}${escapeHtml(entry.name)}</li>`).join("")}</ol></td>
|
||||
</tr>`).join("")}
|
||||
</tbody>
|
||||
@@ -204,6 +210,7 @@ export function renderDriverBoard({ t, escapeHtml, date, rows, getClassLabel, ge
|
||||
${row.afterBreak ? `<p class="board-break-note">${escapeHtml(fixedBreakText(row.afterBreak, t))}</p>` : ""}
|
||||
<h3>${escapeHtml(rowLabel(row, getClassLabel))}</h3>
|
||||
${called ? `<p class="board-heads-up">📢 ${escapeHtml(t("day.board_heads_up"))}</p>` : ""}
|
||||
${row.marshals?.length ? `<p class="board-marshals">${escapeHtml(t("day.marshals", { names: marshalNames(row) }))}</p>` : ""}
|
||||
<ol>${getSessionGridEntries(row.session).map((entry) => `<li>${rowFlag(entry)}${escapeHtml(entry.name)}</li>`).join("") || `<li>${escapeHtml(t("race_day.no_start_list"))}</li>`}</ol>
|
||||
</article>`;
|
||||
};
|
||||
|
||||
@@ -5072,6 +5072,7 @@ tr.is-selected td { background: color-mix(in srgb, var(--danger) 12%, transparen
|
||||
.day-fixed-break input[name="breakLabel"] { width: 10em; flex: 0 1 10em; min-width: 6em; }
|
||||
.day-fixed-break input[type="time"] { width: 7.5em; flex: 0 0 7.5em; }
|
||||
.day-fixed-break-row .btn, .day-fixed-break > .btn { width: auto; flex: 0 0 auto; }
|
||||
.board-marshals { margin: 2px 0 6px; color: #f5b942; font-weight: 600; }
|
||||
.board-break, .board-break-note, .board-break-row td { color: var(--gold, #d9a441); font-weight: 700; }
|
||||
|
||||
/* A driver's country flag before the name (src/flags, local SVG). */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { orderDaySessions, buildDaySchedule, getAutopilotAction, normalizeRaceDays, moveInDayOrder, pickBoardDate, fixedBreakWindow, withRaceSetupStart, eventScheduleFromDayRows } from "../src/day_schedule_logic.js";
|
||||
import { assignMarshals, orderDaySessions, buildDaySchedule, getAutopilotAction, normalizeRaceDays, moveInDayOrder, pickBoardDate, fixedBreakWindow, withRaceSetupStart, eventScheduleFromDayRows } from "../src/day_schedule_logic.js";
|
||||
|
||||
const events = [
|
||||
{ id: "e4", name: "Cup #1 4WD", date: "2026-11-08", mode: "race" },
|
||||
@@ -211,3 +211,14 @@ test("Race setup shows its race's heats with Race Day's times (lunch and other c
|
||||
assert.equal(own[0].plannedStart, T("11:50"));
|
||||
assert.equal(own[1].plannedStart, T("13:07"), "the other class would run into lunch, goes 13:00-13:05, then a2 after the gap");
|
||||
});
|
||||
|
||||
test("marshals: the drivers of the heat before (or after), never someone driving the heat", () => {
|
||||
const entrants = { h1: ["a", "b"], h2: ["c", "d", "a"], h3: ["e"] };
|
||||
const rows = ["h1", "h2", "h3"].map((id) => ({ session: { id } }));
|
||||
const of = (session) => entrants[session.id].map((id) => ({ driverId: id, name: id.toUpperCase() }));
|
||||
const names = (list) => list.map((row) => row.marshals.map((entry) => entry.name).join(""));
|
||||
assert.deepEqual(names(assignMarshals(rows, "previous", of)), ["", "B", "CDA"], "a drives h2 too, so only b marshals it");
|
||||
assert.deepEqual(names(assignMarshals(rows, "next", of)), ["CD", "E", ""]);
|
||||
assert.deepEqual(names(assignMarshals(rows, "off", of)), ["", "", ""]);
|
||||
assert.equal(normalizeRaceDays([{ date: "2026-11-08", marshalRule: "bogus" }])[0].marshalRule, "off");
|
||||
});
|
||||
Reference in new issue
Block a user