feat(results): print or PDF one finished heat; results list finals first (1.89.12)

This commit is contained in:
larssand committed 2026-11-12 21:51:03 +01:00
1 parent 3a0e871ebc
commit 4a1460b480
10 files changed
+111 -35

No files matched your search

+13
View File
@@ -71,3 +71,16 @@ test("finals show each driver's qualifying place, with TQ for the top qualifier"
assert.deepEqual(finals.standings.map((row) => [row.rank, row.qual]), [["A1", "2"], ["A2", "TQ"]]);
assert.equal(overview.phases.find((phase) => phase.type === "practice").heats[0].rows[0].qual, "", "only finals get the column");
});
test("a finished heat in the overview has its own print and PDF buttons; a heat not run has none", async () => {
const { renderRaceOverviewPanel } = await import("../src/race_overview_view.js");
const row = { pos: 1, name: "Roy", laps: 12, result: "12/5:01.2", bestLapMs: 18000 };
const overview = { event: { name: "Cup" }, podium: [], phases: [{ type: "final", planned: 2, standings: [], heats: [
{ session: { id: "fA", name: "A Final 1", status: "finished" }, rows: [row] },
{ session: { id: "fB", name: "A Final 2", status: "ready" }, rows: [] },
] }] };
const html = renderRaceOverviewPanel(overview, { t: (k) => k, escapeHtml: String, formatLap: String, renderTable: () => "<table></table>", renderRaceStandingsTableView: () => "", phaseLabel: (x) => x, getStatusLabel: (x) => x });
assert.match(html, /data-heat-print="fA"/);
assert.match(html, /data-heat-pdf="fA"/);
assert.doesNotMatch(html, /data-heat-print="fB"/);
});