feat(results): gold, silver and bronze medals for the top three in PDF, printouts and result tables (1.73.0)

This commit is contained in:
larssand committed 2026-11-06 23:12:29 +01:00
1 parent 7c25f23ad0
commit 41043a990d
12 files changed
+72 -12

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
import { medal } from "./medal.js";
// Race Day → Race overview panel: podium, then practice / qualifying / finals with standings
// and every heat. Logic in race_overview_logic.js; print, PDF and CSV come in as deps.
const openPhases = new Set();
@@ -7,7 +8,7 @@ export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, re
const { event, phases, podium } = overview;
const heatTable = (rows) => renderTable(
[t("table.pos"), 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) => `<tr><td>${row.pos}</td><td>${escapeHtml(row.name)}</td>${rows.some((item) => item.car) ? `<td>${escapeHtml(row.car || "-")}</td>` : ""}<td>${row.laps}</td><td>${escapeHtml(row.result)}</td><td>${row.bestLapMs ? escapeHtml(formatLap(row.bestLapMs)) : "-"}</td></tr>`)
rows.map((row) => `<tr><td>${medal(row.pos)}</td><td>${escapeHtml(row.name)}</td>${rows.some((item) => item.car) ? `<td>${escapeHtml(row.car || "-")}</td>` : ""}<td>${row.laps}</td><td>${escapeHtml(row.result)}</td><td>${row.bestLapMs ? escapeHtml(formatLap(row.bestLapMs)) : "-"}</td></tr>`)
);
return `
<section class="panel mt-16 race-overview" id="raceDayOverview">
@@ -20,7 +21,7 @@ export function renderRaceOverviewPanel(overview, { t, escapeHtml, formatLap, re
</div>
</div>
<div class="panel-body">
${podium.length ? `<ol class="race-overview-podium">${podium.map((row, index) => `<li class="podium-${index + 1}"><span>${index + 1}</span><strong>${escapeHtml(row.driverName || "-")}</strong></li>`).join("")}</ol>` : ""}
${podium.length ? `<ol class="race-overview-podium">${podium.map((row, index) => `<li class="podium-${index + 1}">${medal(index + 1)}<strong>${escapeHtml(row.driverName || "-")}</strong></li>`).join("")}</ol>` : ""}
${phases.map((phase) => `
<details class="race-overview-phase" data-phase="${phase.type}" ${openPhases.has(phase.type) ? "open" : ""}>
<summary><strong>${escapeHtml(phaseLabel(phase.type))}</strong> <small>${t("race_overview.heats_done", { done: phase.heats.filter(({ session }) => session.status === "finished").length, total: phase.planned })}</small></summary>