feat(results): qualifying place (TQ) next to final results and podium bands for the top three (1.74.0)

This commit is contained in:
larssand committed 2026-11-06 23:31:09 +01:00
1 parent 41043a990d
commit fee9f8073d
12 files changed
+149 -38

No files matched your search

+31 -12
View File
@@ -1,4 +1,4 @@
import { medal } from "./medal.js";
import { medal, qualCell } from "./medal.js";
import { getSyncStatus } from "./sync_status.js";
import { installListSorting } from "./list_sorting.js";
import { escapeHtml } from "./html_escape.js";
@@ -10,7 +10,7 @@ import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologu
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay, refreshRaceDayLive } from "./race_day_view.js";
import { normalizeRaceDays, getRaceDay, upsertRaceDay, orderDaySessions, buildDaySchedule, getAutopilotAction, moveInDayOrder, pickBoardDate, getDueCall } from "./day_schedule_logic.js";
import { buildRaceOverview, buildRaceOverviewCsvRows } from "./race_overview_logic.js";
import { buildRaceOverview, buildRaceOverviewCsvRows, withQualifyingPlaces } from "./race_overview_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";
@@ -130,7 +130,12 @@ const buildTeamStintLog = (session, row) => buildTeamStintLogLogic(session, row,
const getSessionGridEntries = (session) => getSessionGridEntriesLogic(session, { state, t, getEventTeams, getDriverDisplayById, getSessionGridOrder });
const getSessionGridOrder = (session) => getSessionGridOrderLogic(session);
const ensureSessionDriverOrder = (session) => ensureSessionDriverOrderLogic(session, { getSessionEntrants });
const buildFinalStandings = (event) => buildFinalStandingsLogic(event, { getSessionsForEvent, buildLeaderboard, getSessionEntrants, t });
// Final standings carry each driver's qualifying place (qual, "TQ" for the top qualifier).
const buildFinalStandings = (event) => {
const rows = buildFinalStandingsLogic(event, { getSessionsForEvent, buildLeaderboard, getSessionEntrants, t });
const qualified = rows.length && getSessionsForEvent(event.id).some((session) => session.type === "qualification" && session.status !== "ready");
return qualified ? withQualifyingPlaces(rows, buildQualifyingStandings(event)) : rows;
};
const getManualCorrectionSummary = (row) => getManualCorrectionSummaryLogic(row, { formatLap });
const renderTeamStintLog = (session, rows) => renderTeamStintLogHelper(session, rows, { t, escapeHtml, buildTeamStintLog, formatTeamActiveMemberLabel, renderTable, formatRaceClock });
@@ -158,8 +163,8 @@ const bindRaceOverviewFor = (root, event) => event && bindRaceOverviewPanel(root
const renderRaceOverviewHeatsHtml = (event) => (getRaceOverview(event)?.phases || []).flatMap((phase) => phase.heats.map(({ session, rows }) => `
<section class="print-block">
<h2>${escapeHtml(raceOverviewPhaseLabel(phase.type))} • ${escapeHtml(session.name)}</h2>
${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>${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>`))}
${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) => `<tr><td>${medal(row.pos)}</td>${rows.some((item) => item.qual) ? qualCell(row.qual, escapeHtml) : ""}<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>`))}
</section>`)).join("");
const getSessionsForEvent = (eventId) => getSessionsForEventHelper(state, eventId);
const getModeLabel = (mode) => getModeLabelHelper(mode, { t });
@@ -2867,6 +2872,7 @@ const TRANSLATIONS = {
"table.loop": "Loop",
"table.strength": "Signal",
"table.pos": "Pos",
"table.qual": "Kval",
"table.laps": "Varv",
"table.last_lap": "Senaste varv",
"table.best_lap": "Bästa varv",
@@ -4993,6 +4999,7 @@ const TRANSLATIONS = {
"table.loop": "Loop",
"table.strength": "Strength",
"table.pos": "Pos",
"table.qual": "Qual.",
"table.laps": "Laps",
"table.last_lap": "Last Lap",
"table.best_lap": "Best Lap",
@@ -7438,8 +7445,8 @@ function decoratePrintTables(doc) {
});
if (/^(pos|plac|placering|place|#)\.?$/i.test(headers[0]?.textContent.trim() || "")) {
rows.forEach((row) => {
const pos = row.children[0]?.textContent.trim();
if (["1", "2", "3"].includes(pos)) row.classList.add(`podium-${pos}`);
const place = /^A?([1-3])$/.exec(row.children[0]?.textContent.trim() || "")?.[1];
if (place) row.classList.add(`podium-${place}`);
});
}
});
@@ -7492,7 +7499,12 @@ function openPrintWindow(title, bodyHtml) {
tbody tr:nth-child(even) td { background: ${theme.zebra}; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.pos, th.pos { text-align: center; width: 1%; white-space: nowrap; }
tr.podium-1 td:first-child { box-shadow: inset 4px 0 #d4af37; } tr.podium-2 td:first-child { box-shadow: inset 4px 0 #a9b0bb; } tr.podium-3 td:first-child { box-shadow: inset 4px 0 #c27c3e; }
tr.podium-1 { background: linear-gradient(90deg, rgba(240, 197, 63, 0.35), rgba(240, 197, 63, 0) 70%); }
tr.podium-2 { background: linear-gradient(90deg, rgba(170, 180, 192, 0.35), rgba(170, 180, 192, 0) 70%); }
tr.podium-3 { background: linear-gradient(90deg, rgba(205, 127, 60, 0.32), rgba(205, 127, 60, 0) 70%); }
tbody tr.podium-1 td, tbody tr.podium-2 td, tbody tr.podium-3 td { background: transparent !important; }
td.qual-cell, th.qual-cell { text-align: center; color: #6b7486; }
.tq-badge { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 9.5px; font-weight: 800; color: #1d2330; background: linear-gradient(135deg, #ffe58a, #f2b705); }
tr.podium-1 td, tr.podium-2 td, tr.podium-3 td { font-weight: 700; }
.medal { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; text-align: center; font-weight: 800; font-size: 11px; color: #4a3500; background: radial-gradient(circle at 32% 28%, #fff7cf 0%, #f4cf55 38%, #c9971c 75%, #9c7210 100%); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4); }
.medal-2 { color: #33383f; background: radial-gradient(circle at 32% 28%, #ffffff 0%, #dfe3e8 38%, #a8b0ba 75%, #7d8691 100%); }
@@ -7640,15 +7652,22 @@ async function exportRaceResultsPdf(event) {
),
buildPdfSection(
t("events.final_standings"),
[t("table.pos"), t("table.driver"), t("table.score")],
buildFinalStandings(event).map((row) => [String(row.rank), row.driverName || "-", row.score || "-"])
...(() => {
const rows = buildFinalStandings(event);
const withQual = rows.some((row) => row.qual);
return [
[t("table.pos"), ...(withQual ? [t("table.qual")] : []), t("table.driver"), t("table.score")],
rows.map((row) => [String(row.rank), ...(withQual ? [row.qual || "-"] : []), row.driverName || "-", row.score || "-"]),
];
})()
),
...(getRaceOverview(event)?.phases || []).flatMap((phase) => phase.heats.map(({ session, rows }) => {
const withCar = rows.some((row) => row.car);
const withQual = rows.some((row) => row.qual);
return buildPdfSection(
`${raceOverviewPhaseLabel(phase.type)} • ${session.name}`,
[t("table.pos"), t("table.driver"), ...(withCar ? [t("race_overview.car")] : []), t("table.laps"), t("table.result"), t("table.best_lap")],
rows.map((row) => [String(row.pos), row.name, ...(withCar ? [row.car || "-"] : []), String(row.laps), row.result, row.bestLapMs ? formatLap(row.bestLapMs) : "-"])
[t("table.pos"), ...(withQual ? [t("table.qual")] : []), t("table.driver"), ...(withCar ? [t("race_overview.car")] : []), t("table.laps"), t("table.result"), t("table.best_lap")],
rows.map((row) => [String(row.pos), ...(withQual ? [row.qual || "-"] : []), row.name, ...(withCar ? [row.car || "-"] : []), String(row.laps), row.result, row.bestLapMs ? formatLap(row.bestLapMs) : "-"])
);
})),
...buildTeamRaceStandings(event).map(({ session, rows }) =>