From bfffde86b923be05c83291e4c0bb81bd788743fe Mon Sep 17 00:00:00 2001 From: larssand Date: Mon, 16 Nov 2026 23:27:04 +0100 Subject: [PATCH] feat(export): lap times in a heat's print/PDF is a remembered choice, off by default (1.89.53) --- CHANGELOG.md | 4 ++++ README.md | 2 +- README.sv.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/app.js | 14 +++++++++++--- src/race_overview_view.js | 6 ++++-- src/runtime_services.js | 1 + 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06f3a49..6249180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The application version is maintained in `package.json` and displayed in the adm No changes recorded yet. +## 1.89.53 - 2026-11-16 + +- The lap times table in a heat's print and PDF is now a choice: **Lap times in 🖹/PDF** next to Print / PDF / CSV in the race overview (remembered, off by default). Off, a heat prints on one page with the result and the lap chart, as before. + ## 1.89.52 - 2026-11-16 - Heat print and PDF: under the lap chart, every lap time in a table – a row per lap, a column per driver in finish order. Each driver's best lap is bold on green and the fastest lap of the heat bold on purple. Only with a single heat, so the full results stay short. diff --git a/README.md b/README.md index 302f927..c2e5620 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create - **▶ Run the day automatically** starts each heat's count-down on its own when the schedule says so, and waits (saying why) while a heat runs, the decoder is offline or a heat is not ready. With several classes on one day, every class's heats run in the same order. Finals are never created automatically: when a class's qualifying is done it says "Waiting: check qualifying and press 🏁 Create finals for 
" with the class names, so qualifying can be corrected first. Then the autopilot runs the finals. It runs only in the browser where it was turned on. **■ Stop autopilot** to run heats by hand; turning it on again carries on with the next heat not yet run. **⏞ Pause the day** pauses the heat on track (or holds the count-down) and the autopilot until **Resume the day**. - **Race overview** (under the heat queue): the whole race of the current event in one place - the podium from the A final, then practice, qualifying and finals that open and close, each with the standings and every heat's result (laps, result, best lap, and the car in sponsor heats). **Print**, **PDF** and **CSV** export the whole race with every heat, finals on top (A final first), then qualifying, then practice. A finished heat or final has its own **🖹** and **PDF** buttons for just that heat, e.g. for the board in the pits. - **📈 Lap chart:** every qualifying heat and final has a fold-out lap chart - each driver's place after every lap as a coloured line, place 1 on top, names at their official finish place. Counted from the passings, nothing extra to set up. It is printed and in the PDF of a single heat, and with the finals in the full results. - - **⏱ Lap times:** the print and PDF of a single heat also list every lap, a column per driver in finish order; each driver's best lap is bold on green and the fastest lap of the heat purple. + - **⏱ Lap times:** tick **Lap times in 🖹/PDF** (next to Print / PDF / CSV in the race overview) and the print and PDF of a single heat also list every lap, a column per driver in finish order; each driver's best lap is bold on green and the fastest lap of the heat purple. Off by default, so a heat prints on one page; the lap chart is always there. - **Speaker panel** (under the start buttons): track call, track clear, red flag, pause, resume, false start and marshal warning. Under **Sound and calls** are quick switches that save at once: mute all, lap time calls, race leader calls, practice hype and the speaker cues. - **Preflight** checks the decoder, participants, transponders (missing or duplicated), the lap window, the grid and audio. Blockers come first, each with a shortcut to the right setting. The min/max lap time can be edited right there. - **An automatic SQLite backup** is taken before every start. diff --git a/README.sv.md b/README.sv.md index 61eef49..0e15402 100644 --- a/README.sv.md +++ b/README.sv.md @@ -129,7 +129,7 @@ GrĂ€nssnittet finns pĂ„ svenska och engelska. - **Heat-kön** visar aktuellt, nĂ€sta och dĂ€rpĂ„ följande heat i körordning: trĂ€ning, kval omgĂ„ng för omgĂ„ng (Q1 H1, Q1 H2, Q2 H1 
), sedan finaler frĂ„n lĂ€gsta (C, B, A). NĂ€r ett heat Ă€r klart vĂ€ljer **▶ NĂ€sta** nĂ€sta heat med ett klick. Sessionslistorna i Race Setup och pĂ„ Race Day följer samma ordning, sĂ„ ett heat som tagits bort och skapats om hamnar pĂ„ rĂ€tt plats; **â–Čâ–Œ** pĂ„ en session i Race Setup flyttar den tidigare eller senare. - **Race-översikt** (under heatkön): hela racet för det aktuella eventet pĂ„ ett stĂ€lle – pallen frĂ„n A-finalen, sedan trĂ€ning, kval och finaler som kan fĂ€llas ut, var och en med stĂ€llning och varje heats resultat (varv, resultat, bĂ€sta varv, och bilen i sponsorheat). **Skriv ut**, **PDF** och **CSV** exporterar hela racet med alla heat, finalerna överst (A-finalen först), sedan kval och sist trĂ€ning. Ett avslutat heat eller en final har egna knappar **🖹** och **PDF** för bara det heatet, t.ex. till tavlan i depĂ„n. - **📈 Varvdiagram:** varje kvalheat och final har ett utfĂ€llbart varvdiagram – varje förares placering efter varje varv som en fĂ€rgad linje, 1:a överst, namnen vid den officiella placeringen. RĂ€knas frĂ„n passeringarna, inget att stĂ€lla in. Det kommer med i utskrift och PDF av ett enskilt heat, och med finalerna i hela resultatet. - - **⏱ Varvtider:** utskrift och PDF av ett enskilt heat listar ocksĂ„ alla varv, en kolumn per förare i placeringsordning; förarens bĂ€sta varv Ă€r fett pĂ„ grönt och heatets snabbaste varv lila. + - **⏱ Varvtider:** kryssa i **Varvtider i 🖹/PDF** (bredvid Skriv ut / PDF / CSV i race-översikten) sĂ„ listar utskrift och PDF av ett enskilt heat ocksĂ„ alla varv, en kolumn per förare i placeringsordning; förarens bĂ€sta varv Ă€r fett pĂ„ grönt och heatets snabbaste varv lila. Av frĂ„n början, sĂ„ ett heat ryms pĂ„ en sida; varvdiagrammet kommer alltid med. - **Speakerpanel** (under startknapparna): stopp pĂ„ banan, banan fri, röd flagg, paus, fortsĂ€tt, tjuvstart och banvaktsvarning. Under **Ljud och utrop** finns snabbval som sparas direkt: tysta allt, varvtidsutrop, ledarutrop, pepp under trĂ€ning och speaker-utropen. - **Förkontrollen** kontrollerar decoder, deltagare, transpondrar (saknade eller dubbletter), varvtidsgrĂ€nser, grid och ljud. Blockerare visas först, var och en med en genvĂ€g till rĂ€tt instĂ€llning. Min/max-varvtid kan Ă€ndras direkt dĂ€r. - **En automatisk SQLite-backup** tas före varje start. diff --git a/package-lock.json b/package-lock.json index e2a495c..3ff0988 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.89.52", + "version": "1.89.53", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.89.52", + "version": "1.89.53", "hasInstallScript": true, "license": "AGPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 48c64ad..b166210 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.89.52", + "version": "1.89.53", "private": true, "license": "AGPL-3.0-or-later", "description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence", diff --git a/src/app.js b/src/app.js index 512f40d..8e48f4c 100644 --- a/src/app.js +++ b/src/app.js @@ -182,12 +182,13 @@ const buildRaceResultsHtml = (event) => buildRaceResultsHtmlHelper(event, { t, e // Race overview (Race Day and the results archive): the whole race, with print, PDF and CSV. const getRaceOverview = (event) => buildRaceOverview(event, { sessions: getSessionsForEvent(event?.id), cars: state.cars, buildLeaderboard, buildPracticeStandings, buildQualifyingStandings, buildFinalStandings, getCompetitorPassings }); const raceOverviewPhaseLabel = (type) => t(`race_overview.phase_${type}`); -const renderRaceOverviewFor = (event) => (event ? renderRaceOverviewPanel(getRaceOverview(event), { t, escapeHtml, formatLap, renderTable, renderRaceStandingsTableView, phaseLabel: raceOverviewPhaseLabel, getStatusLabel }) : ""); +const renderRaceOverviewFor = (event) => (event ? renderRaceOverviewPanel(getRaceOverview(event), { t, escapeHtml, formatLap, renderTable, renderRaceStandingsTableView, phaseLabel: raceOverviewPhaseLabel, getStatusLabel, lapTimes: state.settings.heatPrintLapTimes === true }) : ""); const bindRaceOverviewFor = (root, event) => event && bindRaceOverviewPanel(root, getRaceOverview(event), { print: () => openPrintWindow(`${event.name} - ${t("events.results_overview")}`, buildRaceResultsHtml(event)), pdf: () => exportRaceResultsPdf(event), printHeat: (sessionId) => printHeatResult(event, sessionId), pdfHeat: (sessionId) => exportHeatResultPdf(event, sessionId), + setLapTimes: (on) => { state.settings.heatPrintLapTimes = on; saveState(); }, csv: (overview) => downloadCsvFile(`${sanitizeFilenameSegment(event.name)}_race_overview.csv`, buildRaceOverviewCsvRows(overview, { t, formatLap, phaseLabel: raceOverviewPhaseLabel })), }); // Every heat's result, for the printed results overview (or just one heat: onlySessionId). @@ -215,7 +216,7 @@ const renderRaceOverviewHeatsHtml = (event, onlySessionId = "") => getOverviewHe ${renderTable([t("table.pos"), ...(rows.some((row) => row.qual) ? [t("table.qual")] : []), t("table.driver"), ...(rows.some((row) => row.car) ? [t("race_overview.car")] : []), t("table.laps"), t("table.result"), t("table.best_lap")], rows.map((row) => `${medal(row.pos)}${rows.some((item) => item.qual) ? qualCell(row.qual, escapeHtml) : ""}${rowFlag(row)}${escapeHtml(row.name)}${rows.some((item) => item.car) ? `${escapeHtml(row.car || "-")}` : ""}${row.laps}${escapeHtml(row.result)}${row.bestLapMs ? escapeHtml(formatLap(row.bestLapMs)) : "-"}`))} ${lapChart && (onlySessionId || phase.type === "final") ? `` : ""} - ${lapTable && onlySessionId ? renderPrintLapTable(lapTable) : ""} + ${lapTable && onlySessionId && state.settings.heatPrintLapTimes ? renderPrintLapTable(lapTable) : ""} `).join(""); const buildHeatPdfSection = ({ session, rows, phase, lapChart, lapTable }, { withChart = true } = {}) => { const withCar = rows.some((row) => row.car); @@ -229,7 +230,7 @@ const buildHeatPdfSection = ({ session, rows, phase, lapChart, lapTable }, { wit const withLapChart = lapChart && withChart ? { ...section, chart: { title: t("lap_chart.title"), lapLabel: t("table.lap"), ...lapChart } } : section; // The lap times (a column per driver, best laps marked) only with a single heat's PDF. const shortLap = (ms) => (ms ? formatLap(ms).replace(/^0:/, "") : ""); - return lapTable && withChart + return lapTable && withChart && state.settings.heatPrintLapTimes ? { ...withLapChart, lapTable: { title: t("lap_table.title"), lapLabel: t("table.lap"), names: lapTable.names, rows: lapTable.rows.map((row) => row.map(shortLap)), best: lapTable.best, fastest: lapTable.fastest, legend: t("lap_table.legend") } } : withLapChart; }; @@ -2599,6 +2600,8 @@ const TRANSLATIONS = { "events.practice_seed_method": "Practice-seedning: metod", "seed.in_a_row": "{n} i rad", "lap_table.title": "Varvtider", + "race_overview.lap_times": "Varvtider i 🖹/PDF", + "race_overview.lap_times_hint": "Tar med alla varvtider (en kolumn per förare, bĂ€sta varv markerade) nĂ€r ett enskilt heat skrivs ut eller sparas som PDF. Av = en sida med resultat och varvdiagram.", "lap_table.legend": "Fet = förarens bĂ€sta varv · lila = heatets snabbaste varv", "seed.average": "snitt {n}", "seed.best_sum": "{n} bĂ€sta", @@ -5051,6 +5054,8 @@ const TRANSLATIONS = { "events.practice_seed_method": "Practice seeding: method", "seed.in_a_row": "{n} in a row", "lap_table.title": "Lap times", + "race_overview.lap_times": "Lap times in 🖹/PDF", + "race_overview.lap_times_hint": "Adds every lap time (a column per driver, best laps marked) when a single heat is printed or saved as PDF. Off = one page with the result and the lap chart.", "lap_table.legend": "Bold = the driver's best lap · purple = the fastest lap of the heat", "seed.average": "avg {n}", "seed.best_sum": "best {n}", @@ -6956,6 +6961,7 @@ function loadState() { : [], obsOverlay: normalizeObsOverlaySettings(parsed.settings?.obsOverlay), raceAudio: normalizeRaceAudioSettings(parsed.settings?.raceAudio), + heatPrintLapTimes: parsed.settings?.heatPrintLapTimes === true, }, decoder: { connected: false, @@ -7028,6 +7034,8 @@ function loadState() { logoDataUrl: "", racePresets: [], obsOverlay: normalizeObsOverlaySettings(), + // Lap times table in a single heat's print / PDF (off: the print stays one page). + heatPrintLapTimes: false, raceAudio: normalizeRaceAudioSettings(), }, decoder: { diff --git a/src/race_overview_view.js b/src/race_overview_view.js index 0de51dd..49b8a33 100644 --- a/src/race_overview_view.js +++ b/src/race_overview_view.js @@ -5,7 +5,7 @@ import { renderLapChartSvg } from "./lap_chart_logic.js"; // and every heat. Logic in race_overview_logic.js; print, PDF and CSV come in as deps. const openPhases = new Set(); -export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, renderTable, renderRaceStandingsTableView, phaseLabel, getStatusLabel }) { +export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, renderTable, renderRaceStandingsTableView, phaseLabel, getStatusLabel, ...options }) { if (!overview || !overview.phases.length) return ""; const { event, phases, podium } = overview; const heatTable = (rows) => renderTable( @@ -20,6 +20,7 @@ export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, re +
@@ -40,7 +41,8 @@ export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, re `; } -export function bindRaceOverviewPanel(root, overview, { print, pdf, csv, printHeat = () => {}, pdfHeat = () => {} }) { +export function bindRaceOverviewPanel(root, overview, { print, pdf, csv, printHeat = () => {}, pdfHeat = () => {}, setLapTimes = () => {} }) { + root.querySelector("[data-race-overview-lap-times]")?.addEventListener("change", (change) => setLapTimes(change.currentTarget.checked)); if (!root || !overview) return; root.querySelectorAll(".race-overview-phase").forEach((node) => node.addEventListener("toggle", () => { if (node.open) openPhases.add(node.dataset.phase); else openPhases.delete(node.dataset.phase); diff --git a/src/runtime_services.js b/src/runtime_services.js index 9ff681f..9419f48 100644 --- a/src/runtime_services.js +++ b/src/runtime_services.js @@ -148,6 +148,7 @@ export function applyPersistedStateHelper(persisted, deps) { audioEnabled: persisted.settings?.audioEnabled !== false, passingSoundMode: persisted.settings?.passingSoundMode || state.settings.passingSoundMode || "beep", finishVoiceEnabled: persisted.settings?.finishVoiceEnabled !== false, + heatPrintLapTimes: persisted.settings?.heatPrintLapTimes === true, startSoundEnabled: persisted.settings?.startSoundEnabled !== false, finishSoundEnabled: persisted.settings?.finishSoundEnabled !== false, speechVoiceUri: String(persisted.settings?.speechVoiceUri || state.settings.speechVoiceUri || ""),