diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15c97b7..732ebcd 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.32
+
+- **Lap chart in the results:** every qualifying heat and final in the race overview (Race Day and the results archive) has a fold-out đ lap chart - each driver's place after every lap, from the passings. It is in the print and PDF of a single heat, and with the finals in the full results PDF and print.
+
## 1.89.31 - 2026-11-14
### Added
diff --git a/README.md b/README.md
index 6c74fa0..1f8a05c 100644
--- a/README.md
+++ b/README.md
@@ -114,6 +114,7 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create
- **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.
- **â¶ 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.
- **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 badf69e..dfd084e 100644
--- a/README.sv.md
+++ b/README.sv.md
@@ -127,6 +127,7 @@ GrÀnssnittet finns pÄ svenska och engelska.
- **â¶ Kör dagen automatiskt** startar varje heats nedrĂ€kning sjĂ€lv nĂ€r schemat sĂ€ger det, och vĂ€ntar (och sĂ€ger varför) medan ett heat körs, decodern Ă€r frĂ„nkopplad eller ett heat inte Ă€r redo. Med flera klasser samma dag körs alla klassernas heat i samma ordning. Finaler skapas aldrig automatiskt: nĂ€r kvalet Ă€r klart i en klass stĂ„r det "VĂ€ntar: kontrollera kvalet och tryck đ Skapa finaler för âŠ" med klassernas namn, sĂ„ att kvalet kan korrigeras först. Sedan kör automatiken finalerna. Den körs bara i webblĂ€saren dĂ€r den slogs pĂ„. **â Stoppa automatiken** för att köra för hand; slĂ„r du pĂ„ den igen fortsĂ€tter den med nĂ€sta heat som inte Ă€r kört. **âž Pausa dagen** pausar heatet pĂ„ banan (eller hĂ„ller nedrĂ€kningen) och automatiken tills **FortsĂ€tt dagen**.
- **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.
- **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/docs/javascript-architecture.md b/docs/javascript-architecture.md
index 6bd091b..fc29fb6 100644
--- a/docs/javascript-architecture.md
+++ b/docs/javascript-architecture.md
@@ -2978,3 +2978,6 @@ Tests: decoder_diagnostics.test.js covers bounds, isolation, snapshots and outco
`loadProfile` serializes requests, uses AbortController with a 15-second timer, and releases its lock in finally. Existing 10-second visible-page polling and before/after-response edit guards remain. Only a successfully applied profile updates lastSuccessAt; responses deferred due to active editing never falsely refresh it. Failed background requests preserve loaded DOM and data. A 30-second age marks data stale. Retry uses the same background-safe load path. Status is not a write acknowledgement or decoder health indicator. This change adds no persistence or server/API contract.
`tests/public_training_refresh.test.js` exercises stale/failure/recovery, non-overlap, deferred responses, independent status DOM and timeout recovery. Browser smoke coverage simulates network loss on a real personal profile and retries after network restoration using isolated state.
+
+
+`lap_chart_logic.js` (pure) turns a heat's passings into a lap chart: `buildLapChart(entries)` gives each driver's place after every lap (order of crossing for that lap, among those who did it), `renderLapChartSvg()` draws it as a self-styled inline SVG (`currentColor` for axes, so it works in every theme and in print). `buildRaceOverview()` adds `heat.lapChart` for qualifying and finals when given `getCompetitorPassings`; the race overview panel shows it in a ``, `renderRaceOverviewHeatsHtml()` prints it (single heat, or finals in the full results), and `buildHeatPdfSection()` sends it as `section.chart`, which `server.js` `normalizePdfLapChart()` checks and `server/pdf_render.js` `drawLapChart()` draws as vector lines.
diff --git a/package-lock.json b/package-lock.json
index 963d5bf..5dcacc5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "rc-racecore",
- "version": "1.89.31",
+ "version": "1.89.32",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "rc-racecore",
- "version": "1.89.31",
+ "version": "1.89.32",
"hasInstallScript": true,
"dependencies": {
"better-sqlite3": "^12.11.1",
diff --git a/package.json b/package.json
index 2516e53..7a1d408 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rc-racecore",
- "version": "1.89.31",
+ "version": "1.89.32",
"private": true,
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
"engines": {
diff --git a/server.js b/server.js
index f5abab2..159b526 100644
--- a/server.js
+++ b/server.js
@@ -961,6 +961,22 @@ function attachmentDisposition(filename) {
return `attachment; filename="${ascii}"; filename*=UTF-8''${encodeURIComponent(name)}`;
}
+// A heat's lap chart (src/lap_chart_logic.js): places per lap per driver, drawn as lines.
+function normalizePdfLapChart(chart) {
+ if (!chart || !Array.isArray(chart.series)) return null;
+ const laps = Math.min(400, Math.max(0, Math.floor(Number(chart.laps) || 0)));
+ const series = chart.series.slice(0, 24).map((serie) => ({
+ name: String(serie?.name || "-").slice(0, 60),
+ color: /^#[0-9a-f]{6}$/i.test(String(serie?.color || "")) ? String(serie.color) : "#555555",
+ positions: (Array.isArray(serie?.positions) ? serie.positions : []).slice(0, laps).map((place) => {
+ const value = Math.floor(Number(place));
+ return value >= 1 && value <= 24 ? value : null;
+ }),
+ }));
+ if (laps < 2 || series.length < 2) return null;
+ return { title: String(chart.title || "").slice(0, 80), lapLabel: String(chart.lapLabel || "").slice(0, 20), laps, series };
+}
+
function normalizePdfExportPayload(input = {}) {
const title = String(input.title || "RC RaceCore").trim();
const subtitle = String(input.subtitle || "").trim();
@@ -982,6 +998,7 @@ function normalizePdfExportPayload(input = {}) {
: [],
// A country code per row for the flag before the driver's name ("SE", "GB-ENG"); anything else is dropped.
flags: Array.isArray(section?.flags) ? section.flags.map((code) => (/^[A-Z]{2}(-[A-Z]{3})?$/.test(String(code || "")) ? String(code) : "")) : [],
+ chart: normalizePdfLapChart(section?.chart),
}))
: [];
diff --git a/server/pdf_render.js b/server/pdf_render.js
index 0ed0f8a..87025e3 100644
--- a/server/pdf_render.js
+++ b/server/pdf_render.js
@@ -195,6 +195,12 @@ function createWriter(pageWidth, pageHeight, title) {
const size = label.length > 1 ? 6 : 7.5;
writer.text(cx - 6, cy - size / 3, label, size, { bold: true, color: ink, align: "center", width: 12 });
},
+ // An open line through points [[x, y], ...]; dashed draws it dotted.
+ polyline(points, color, width = 1, { dashed = false } = {}) {
+ if (points.length < 2) return;
+ const path = points.map(([px, py], index) => `${n(px)} ${n(py)} ${index ? "l" : "m"}`).join(" ");
+ writer.page.push(`q ${rgb(color)} RG ${width} w 1 J 1 j ${dashed ? "[1.5 2.5] 0 d " : ""}${path} S Q`);
+ },
image(x, y, w, h) {
writer.page.push(`q ${n(w)} 0 0 ${n(h)} ${n(x)} ${n(y)} cm /Im1 Do Q`);
},
@@ -309,6 +315,40 @@ function drawTable(writer, section, theme) {
writer.y -= 10;
}
+// The lap chart under a heat: place 1 on top, a line per driver, names at their finish place.
+function drawLapChart(writer, chart) {
+ const rows = chart.series.length;
+ const rowH = rows > 14 ? 11 : 14;
+ const height = 18 + rows * rowH + 22;
+ writer.ensure(height);
+ writer.text(MARGIN, writer.y - 10, fitText(chart.title, 10, true, writer.width), 10, { bold: true });
+ const top = writer.y - 18;
+ const left = MARGIN + 16;
+ const plotW = writer.width - 16 - 120;
+ const x = (lap) => left + ((lap - 1) / (chart.laps - 1)) * plotW;
+ const y = (place) => top - (place - 0.5) * rowH;
+ for (let place = 1; place <= rows; place += 1) {
+ writer.line(left, y(place), left + plotW, y(place), RULE, 0.4);
+ writer.text(MARGIN, y(place) - 2.5, String(place), 7, { color: MUTED, align: "right", width: 11 });
+ }
+ const step = chart.laps <= 12 ? 1 : chart.laps <= 30 ? 2 : chart.laps <= 60 ? 5 : chart.laps <= 150 ? 10 : 25;
+ for (let lap = 1; lap <= chart.laps; lap += 1) {
+ if (lap === 1 || lap === chart.laps || (lap % step === 0 && chart.laps - lap >= step / 2)) {
+ writer.text(x(lap) - 10, top - rows * rowH - 10, String(lap), 7, { color: MUTED, align: "center", width: 20 });
+ }
+ }
+ writer.text(left + plotW - 60, top - rows * rowH - 20, chart.lapLabel, 7, { color: MUTED, align: "right", width: 60 });
+ chart.series.forEach((serie, index) => {
+ const points = serie.positions.map((place, lap) => (place ? [x(lap + 1), y(place)] : null)).filter(Boolean);
+ if (!points.length) return;
+ writer.polyline(points, serie.color, 1.6);
+ const last = points[points.length - 1];
+ writer.polyline([last, [left + plotW + 6, y(index + 1)]], serie.color, 0.7, { dashed: true });
+ writer.text(left + plotW + 9, y(index + 1) - 2.5, fitText(`${index + 1}. ${serie.name}`, 7.5, true, 110), 7.5, { bold: true, color: serie.color });
+ });
+ writer.y -= height + 8;
+}
+
function drawParagraphs(writer, section) {
section.rows.forEach((row) => row.forEach((value) => {
wrapText(value, 10, false, writer.width).forEach((line) => {
@@ -449,6 +489,7 @@ function buildStyledPdf(payload) {
if (section.title) drawSectionTitle(writer, section.title, theme);
if (section.headers.length) drawTable(writer, section, theme);
else drawParagraphs(writer, section);
+ if (section.chart) drawLapChart(writer, section.chart);
});
drawFooters(writer, pages, payload, theme, pageWidth);
diff --git a/src/app.js b/src/app.js
index f087d32..3c914c8 100644
--- a/src/app.js
+++ b/src/app.js
@@ -15,6 +15,7 @@ import { flagHtml, driverCountryCode, countryChoices, setDriverCountryResolver,
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay, refreshRaceDayLive } from "./race_day_view.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 { renderLapChartSvg } from "./lap_chart_logic.js";
import { renderRaceOverviewPanel, bindRaceOverviewPanel } from "./race_overview_view.js";
import { renderSpeakerPanel, bindSpeakerPanel } from "./speaker_panel_view.js";
import { renderDaySchedulePanel, bindDaySchedulePanel, buildDaySchedulePrintHtml, renderDriverBoard, formatClockTime, renderDayCallBanner, bindDayCallBanner } from "./day_schedule_view.js";
@@ -167,7 +168,7 @@ const buildPrintBrandBlock = (branding) => buildPrintBrandBlockHelper(branding,
const buildRaceStartListsHtml = (event) => buildRaceStartListsHtmlHelper(event, { t, state, escapeHtml, resolveEventBranding, getSessionsForEvent, getSessionSortWeight, getClassName, buildPrintBrandBlock, getSessionGridEntries, getSessionTypeLabel, getStartModeLabel, renderTable, buildEventSchedule });
const buildRaceResultsHtml = (event) => buildRaceResultsHtmlHelper(event, { t, escapeHtml, resolveEventBranding, getClassName, buildPrintBrandBlock, renderRaceStandingsTableView, buildPracticeStandings, buildQualifyingStandings, buildFinalStandings, renderTeamRaceStandings, getSessionsForEvent, renderSessionChannelAnalysis, renderHeatResults: (event) => renderRaceOverviewHeatsHtml(event) });
// 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 });
+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 bindRaceOverviewFor = (root, event) => event && bindRaceOverviewPanel(root, getRaceOverview(event), {
@@ -190,21 +191,24 @@ const getOverviewHeats = (event, onlySessionId = "") => [...(getRaceOverview(eve
return heats.map((heat) => ({ ...heat, phase }));
})
.filter(({ session }) => !onlySessionId || session.id === onlySessionId);
-const renderRaceOverviewHeatsHtml = (event, onlySessionId = "") => getOverviewHeats(event, onlySessionId).map(({ session, rows, phase }) => `
+// The lap chart prints with a single heat, and with the finals in the full results.
+const renderRaceOverviewHeatsHtml = (event, onlySessionId = "") => getOverviewHeats(event, onlySessionId).map(({ session, rows, phase, lapChart }) => `