fix(archive): show qualifying place and TQ when viewing a final heat (1.74.1)
This commit is contained in:
1 parent
fee9f8073d
commit
bea4283130
7 files changed
+55
-8
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { medal } from "./medal.js";
|
||||
import { medal, qualCell } from "./medal.js";
|
||||
import { sortableTable, sortValuesAttribute } from "./list_sorting.js";
|
||||
|
||||
export function buildArchiveRows(state, { getEventName, getClassName, getTrackLayoutLabel, buildLeaderboard }) {
|
||||
@@ -56,9 +56,12 @@ function matchesArchiveFilters(row, filters) {
|
||||
}
|
||||
|
||||
function renderArchiveDetail(row, deps) {
|
||||
const { t, escapeHtml, formatLap, formatRaceClock, renderTable, buildLeaderboard, getCompetitorPassings } = deps;
|
||||
const { t, escapeHtml, formatLap, formatRaceClock, renderTable, buildLeaderboard, getCompetitorPassings, getQualifyingPlaces = () => new Map() } = deps;
|
||||
const { session, event, result } = row;
|
||||
const leaderboard = buildLeaderboard(session);
|
||||
// A final heat shows where each driver qualified ("TQ" for the top qualifier).
|
||||
const qualPlaces = getQualifyingPlaces(session, event);
|
||||
const withQual = leaderboard.some((rowItem) => qualPlaces.get(rowItem.driverId));
|
||||
const adjustments = result?.adjustments || [];
|
||||
return `
|
||||
<section class="panel archive-detail" style="margin-top:14px">
|
||||
@@ -74,10 +77,11 @@ function renderArchiveDetail(row, deps) {
|
||||
<h4>${t("archive.standings")}</h4>
|
||||
${leaderboard.length
|
||||
? renderTable(
|
||||
[t("table.pos"), t("table.driver"), t("table.laps"), t("table.best_lap"), t("timing.total_time")],
|
||||
[t("table.pos"), ...(withQual ? [t("table.qual")] : []), t("table.driver"), t("table.laps"), t("table.best_lap"), t("timing.total_time")],
|
||||
leaderboard.map((rowItem, index) => `
|
||||
<tr>
|
||||
<td>${medal(index + 1)}</td>
|
||||
${withQual ? qualCell(qualPlaces.get(rowItem.driverId), escapeHtml) : ""}
|
||||
<td>${escapeHtml(rowItem.displayName || rowItem.driverName || t("common.unknown_driver"))}</td>
|
||||
<td>${rowItem.laps}</td>
|
||||
<td>${formatLap(rowItem.bestLapMs)}</td>
|
||||
@@ -138,6 +142,7 @@ export function renderResultsArchiveView(deps) {
|
||||
getArchiveFilters, setArchiveFilters, getSelectedSessionId, setSelectedSessionId,
|
||||
getSelectedEventKey = () => "", setSelectedEventKey = () => {},
|
||||
getTrackLayoutLabel, renderRaceOverview = () => "", bindRaceOverview = () => {},
|
||||
getQualifyingPlaces = () => new Map(),
|
||||
} = deps;
|
||||
|
||||
const filters = getArchiveFilters();
|
||||
@@ -216,7 +221,7 @@ export function renderResultsArchiveView(deps) {
|
||||
<div class="panel-body"><h4>${t("archive.heats")}</h4>${heatList}</div>
|
||||
</section>
|
||||
${selectedGroup.event ? renderRaceOverview(selectedGroup.event) : ""}` : ""}
|
||||
${shownRow ? renderArchiveDetail(shownRow, { t, escapeHtml, formatLap, formatRaceClock, renderTable, buildLeaderboard, getCompetitorPassings }) : ""}
|
||||
${shownRow ? renderArchiveDetail(shownRow, { t, escapeHtml, formatLap, formatRaceClock, renderTable, buildLeaderboard, getCompetitorPassings, getQualifyingPlaces }) : ""}
|
||||
`;
|
||||
|
||||
const rerender = () => renderResultsArchiveView(deps);
|
||||
|
||||
Reference in new issue
Block a user