diff --git a/CHANGELOG.md b/CHANGELOG.md index d32bb52..5283a44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The application version is maintained in `package.json` and displayed in the adm No changes recorded yet. +## 1.54.0 - 2026-11-02 + +### Changed + +- Today's schedule on Race Day folds the heats already run into one line (✓ 6 heats run – show) and marks the next heat, so what is left of the day is on top. + ## 1.53.0 - 2026-11-02 ### Changed diff --git a/README.md b/README.md index fe54349..b6e6183 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,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 and the break between heats; **▲▼** change the order. A heat that starts late, runs long or is paused moves the rest of the day. +- **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 and the break between heats; **▲▼** 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. diff --git a/README.sv.md b/README.sv.md index 0b8aa4b..edfbf73 100644 --- a/README.sv.md +++ b/README.sv.md @@ -119,7 +119,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 och paus mellan heaten; **▲▼** ändrar ordningen. Ett heat som startar sent, drar ut på tiden eller pausas flyttar resten av dagen. +- **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 och paus mellan heaten; **▲▼** ä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. diff --git a/package-lock.json b/package-lock.json index 190b0b9..5dcac5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.53.0", + "version": "1.54.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.53.0", + "version": "1.54.0", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.11.1", diff --git a/package.json b/package.json index 292582f..889cec6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.53.0", + "version": "1.54.0", "private": true, "description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence", "engines": { diff --git a/src/app.js b/src/app.js index 91672b6..fe44bac 100644 --- a/src/app.js +++ b/src/app.js @@ -375,6 +375,7 @@ const AUTOPILOT_STORAGE_KEY = "rc_day_autopilot"; let autopilotDate = (() => { try { return sessionStorage.getItem(AUTOPILOT_STORAGE_KEY) || ""; } catch { return ""; } })(); let autopilotStatus = ""; let autopilotLaunchingId = null; +let dayShowDone = false; const todayKey = () => { const d = new Date(); return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; }; const getDayPlan = (date) => getRaceDay(state.raceDays, date); const saveDayPlan = (day) => { state.raceDays = upsertRaceDay(state.raceDays, day); saveState(); }; @@ -499,7 +500,7 @@ function moveDaySession(date, sessionId, step) { const formatDayClock = (ts) => formatClockTime(ts); const renderDaySchedule = () => { const date = getRaceDayDate(); - return renderDaySchedulePanel({ t, escapeHtml, date, day: getDayPlan(date), rows: buildDayRows(date), autopilotHere: autopilotDate === date, autopilotStatus: autopilotDate === date ? autopilotStatus : "", getClassLabel: getDayClassLabel }); + return renderDaySchedulePanel({ t, escapeHtml, date, day: getDayPlan(date), rows: buildDayRows(date), autopilotHere: autopilotDate === date, autopilotStatus: autopilotDate === date ? autopilotStatus : "", getClassLabel: getDayClassLabel, showDone: dayShowDone }); }; const bindDaySchedule = (root) => { const date = getRaceDayDate(); @@ -514,6 +515,7 @@ const bindDaySchedule = (root) => { setAutopilot(date, on); }, onPause: () => pauseRaceDay(date), + onToggleDone: () => { dayShowDone = !dayShowDone; renderView(); }, onResume: () => resumeRaceDay(date), }); }; @@ -2871,6 +2873,9 @@ const TRANSLATIONS = { "day.board": "Förarvy", "day.start_time": "Första start", "day.gap": "Paus mellan heat (min)", + "day.show_done": "✓ {count} heat körda – visa", + "day.hide_done": "Dölj körda heat ({count})", + "day.next": "Nästa", "day.call_min": "Upprop (min innan)", "day.call_title": "{name} startar {time} (om {min} min) – dags att ropa upp", "day.call_now": "Ropa ut", @@ -4825,6 +4830,9 @@ const TRANSLATIONS = { "day.board": "Drivers' board", "day.start_time": "First start", "day.gap": "Break between heats (min)", + "day.show_done": "✓ {count} heats run – show", + "day.hide_done": "Hide run heats ({count})", + "day.next": "Next", "day.call_min": "Call (min before)", "day.call_title": "{name} starts at {time} (in {min} min) – time to call it", "day.call_now": "Call now", diff --git a/src/day_schedule_view.js b/src/day_schedule_view.js index 30d5984..3dbe005 100644 --- a/src/day_schedule_view.js +++ b/src/day_schedule_view.js @@ -18,8 +18,11 @@ function stateLabel(row, t, now) { return ""; } -export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopilotHere, autopilotStatus, getClassLabel, now = Date.now() }) { +export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopilotHere, autopilotStatus, getClassLabel, showDone = false, now = Date.now() }) { if (!rows.length) return ""; + // 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; return `
@@ -48,10 +51,11 @@ export function renderDaySchedulePanel({ t, escapeHtml, date, day, rows, autopil - ${rows.map((row, index) => ` - + ${doneCount ? `` : ""} + ${rows.map((row, index) => row.state === "done" && !showDone ? "" : ` + - +
${escapeHtml(t("day.col_time"))}${escapeHtml(t("day.col_session"))}${escapeHtml(t("day.col_drivers"))}
${formatClockTime(row.start)}${row.delayed && row.state !== "done" ? ` (${formatClockTime(row.plannedStart)})` : ""}${escapeHtml(rowLabel(row, getClassLabel))}${row.session.id === nextId ? `${escapeHtml(t("day.next"))} ` : ""}${escapeHtml(rowLabel(row, getClassLabel))} ${row.driverCount ?? ""} ${escapeHtml(stateLabel(row, t, now))} @@ -90,7 +94,8 @@ export function bindDayCallBanner(root, { onCall, onLater }) { root.querySelector("#dayCallLater")?.addEventListener("click", () => onLater(sessionId)); } -export function bindDaySchedulePanel(root, { date, onSavePlan, onMove, onPrint, onBoard, onAutopilot, onPause, onResume }) { +export function bindDaySchedulePanel(root, { date, onSavePlan, onMove, onPrint, onBoard, onAutopilot, onPause, onResume, onToggleDone = () => {} }) { + root.querySelector("#dayToggleDone")?.addEventListener("click", onToggleDone); root.querySelector("#dayPlanForm")?.addEventListener("submit", (event) => { event.preventDefault(); const form = new FormData(event.currentTarget); diff --git a/src/styles.css b/src/styles.css index 672073e..3b49328 100644 --- a/src/styles.css +++ b/src/styles.css @@ -4776,7 +4776,9 @@ tr.is-removed td.lap-actions { .day-schedule-table th { text-align: left; font-size: 0.8rem; color: var(--muted); padding: 6px 8px; } .day-schedule-table td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: middle; } .day-schedule-table tr.is-done { opacity: 0.55; } -.day-schedule-table tr.is-live td { background: rgba(38, 194, 129, 0.12); } +.day-schedule-table tr.is-live td { background: rgba(38, 194, 129, 0.16); font-weight: 700; } +.day-schedule-table tr.is-next td { background: rgba(245, 166, 35, 0.10); } +.day-schedule-table tr.day-done-toggle td { padding: 4px 8px; } .day-schedule-table .day-planned, .day-schedule-table tr.is-delayed td:first-child strong { color: var(--warn); } .day-schedule-table .day-move { white-space: nowrap; text-align: right; } .driver-board { padding: 16px; display: grid; gap: 16px; color: var(--text); } diff --git a/tests/browser_day_schedule.js b/tests/browser_day_schedule.js index 1a2250d..580d9ea 100644 --- a/tests/browser_day_schedule.js +++ b/tests/browser_day_schedule.js @@ -90,6 +90,17 @@ export async function runDayScheduleSmoke({ evaluate, navigate, savedState, wait assert.equal(await evaluate(`document.querySelector(".board-next").classList.contains("is-called")`), true); assert.equal(await evaluate(`document.querySelector(".board-next").dataset.boardSession`), "ds_4wd_q1", "in the day's order"); console.log("PASS the drivers' board shows the next heats with their drivers, called heats highlighted"); + + // A run heat folds away on Race Day; the next one is marked. + const now = Date.now(); + await patchState({ sessions: (await savedState()).sessions.map((session) => (session.id === "ds_4wd_q1" ? { ...session, status: "finished", startedAt: now - 400000, endedAt: now - 100000 } : session)), activeSessionId: "ds_2wd_q1" }); + await navigate("race_day", "daySchedule"); + await waitFor(async () => !(await rowIds()).includes("ds_4wd_q1"), "the run heat is folded away"); + assert.match(await evaluate(`document.getElementById("dayToggleDone").textContent`), /1 heats run/); + assert.equal(await evaluate(`document.querySelector("tr.is-next")?.dataset.dayRow`), (await rowIds())[0], "the next heat is marked"); + await evaluate(`document.getElementById("dayToggleDone").click()`); + await waitFor(async () => (await rowIds()).includes("ds_4wd_q1"), "and shown again on request"); + console.log("PASS today's schedule folds run heats into one line and marks the next heat"); } finally { const current = await savedState(); await patchState({