fix(overlay): Gap shows the gap to the leader, not the same as Gap ahead (1.89.54)
This commit is contained in:
1 parent
bfffde86b9
commit
267b22070c
5 files changed
+33
-9
No files matched your search
@@ -8,6 +8,10 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.89.54 - 2026-11-16
|
||||
|
||||
- Overlay and OBS: the Gap column showed the gap to the car in front, the same as Gap ahead. It now shows the gap to the leader (e.g. +1L for a lapped car), and the leader shows -.
|
||||
|
||||
## 1.89.53 - 2026-11-16
|
||||
|
||||
- The lap times table in a heat's print and PDF is now a choice: **Lap times in 🖨/PDF** next to Print / PDF / CSV in the race overview (remembered, off by default). Off, a heat prints on one page with the result and the lap chart, as before.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.53",
|
||||
"version": "1.89.54",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.53",
|
||||
"version": "1.89.54",
|
||||
"hasInstallScript": true,
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.89.53",
|
||||
"version": "1.89.54",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
|
||||
+9
-5
@@ -2,6 +2,10 @@ import { rowFlag } from "./country_flags.js";
|
||||
import { sortValuesAttribute } from "./list_sorting.js";
|
||||
import { escapeHtml as escapeHtmlLocal } from "./html_escape.js";
|
||||
import { overlayLiveMarks, passingFlashAttrs, renderLiveMarkBadges } from "./overlay_live_marks.js";
|
||||
|
||||
// Gap = to the leader, Gap ahead = to the car in front (both from buildLeaderboard). The leader
|
||||
// itself shows "-". gapDisplay is only set by older callers and tests.
|
||||
const leaderGapOf = (row) => row.leaderGap || row.gapDisplay || "";
|
||||
export function getOverlayModeLabel(mode, { t }) {
|
||||
return t(`overlay.mode_${String(mode || "leaderboard").toLowerCase()}`);
|
||||
}
|
||||
@@ -82,7 +86,7 @@ export function renderOverlayLeaderboard(rows, { t, escapeHtml, formatTeamActive
|
||||
const posClass = idx === 0 ? "pos-1" : idx === 1 ? "pos-2" : idx === 2 ? "pos-3" : "";
|
||||
const rowSortAttr = sortable ? ` data-sort-values="${sortValuesAttribute(practiceRank
|
||||
? [idx + 1, row.displayName || row.driverName, row.practiceMetric?.comparableMs ?? null, row.gapDisplay || null, row.bestLapMs || null]
|
||||
: [idx + 1, row.displayName || row.driverName, row.laps ?? 0, lastLap ? row.lastLapMs || null : row.resultDisplay, row.gapDisplay || row.gapAhead || null, row.gapAhead || null, row.lapDelta || null, row.bestLapMs || null])}"` : "";
|
||||
: [idx + 1, row.displayName || row.driverName, row.laps ?? 0, lastLap ? row.lastLapMs || null : row.resultDisplay, (idx === 0 ? null : leaderGapOf(row) || null), row.gapAhead || null, row.lapDelta || null, row.bestLapMs || null])}"` : "";
|
||||
const linkAttrs = driverLinks && row.driverId && !row.teamId ? ` data-training-driver="${escapeHtml(row.driverId)}" title="${escapeHtml(t("overlay.open_training_stats"))}"` : "";
|
||||
const mark = liveMarks.get(String(row.key ?? ""));
|
||||
const flash = passingFlashAttrs(mark);
|
||||
@@ -116,7 +120,7 @@ export function renderOverlayLeaderboard(rows, { t, escapeHtml, formatTeamActive
|
||||
</div>
|
||||
<div class="overlay-race-metric">
|
||||
<label>${t("table.gap")}</label>
|
||||
<strong>${escapeHtml(row.gapDisplay || row.gapAhead || "-")}</strong>
|
||||
<strong>${escapeHtml(idx === 0 ? "-" : leaderGapOf(row) || "-")}</strong>
|
||||
</div>
|
||||
${practiceRank ? "" : `<div class="overlay-race-metric">
|
||||
<label>${t("table.ahead_gap")}</label>
|
||||
@@ -246,7 +250,7 @@ function renderObsBroadcast({ active, compactRows, startOrder, showStartGrid, fa
|
||||
last: row.lastLapMs > 0 ? escapeHtml(formatLap(row.lastLapMs)) : "-",
|
||||
result: escapeHtml(timeOnly(row.resultDisplay)),
|
||||
best: Number.isFinite(row.bestLapMs) ? escapeHtml(formatLap(row.bestLapMs)) : "-",
|
||||
gap: escapeHtml(idx === 0 ? "" : row.gapDisplay || row.gapAhead || ""),
|
||||
gap: escapeHtml(idx === 0 ? "" : leaderGapOf(row) || ""),
|
||||
};
|
||||
// Pit clock and split at the end of the name column, the one flexible column - in
|
||||
// the time columns they would push every other column out of line.
|
||||
@@ -395,7 +399,7 @@ export function renderObsOverlay(active, leaderboard, result, sessionTiming, bra
|
||||
${obsConfig.showLaps ? `<span>${t("table.laps")}: ${row.laps ?? 0}</span>` : ""}
|
||||
${obsConfig.showLast && row.lastLapMs > 0 ? `<span>${t("overlay.col_last")}: ${escapeHtml(formatLap(row.lastLapMs))}</span>` : ""}
|
||||
${obsShowsResult(active, obsConfig) ? `<span>${t("table.result")}: ${escapeHtml(row.resultDisplay)}</span>` : ""}
|
||||
${obsConfig.showGap ? `<span>${t("table.gap")}: ${escapeHtml(row.gapDisplay || row.gapAhead || "-")}</span>` : ""}
|
||||
${obsConfig.showGap ? `<span>${t("table.gap")}: ${escapeHtml(idx === 0 ? "-" : leaderGapOf(row) || "-")}</span>` : ""}
|
||||
</article>
|
||||
`;
|
||||
}).join("")}
|
||||
@@ -433,7 +437,7 @@ export function renderObsOverlay(active, leaderboard, result, sessionTiming, bra
|
||||
obsConfig.showLast ? `<span>${row.lastLapMs > 0 ? escapeHtml(formatLap(row.lastLapMs)) : "-"}</span>` : "",
|
||||
obsShowsResult(active, obsConfig) ? `<span>${escapeHtml(row.resultDisplay)}</span>` : "",
|
||||
obsConfig.showBest ? `<span>${formatLap(row.bestLapMs)}</span>` : "",
|
||||
obsConfig.showGap ? `<span>${escapeHtml(row.gapDisplay || row.gapAhead || "-")}</span>` : "",
|
||||
obsConfig.showGap ? `<span>${escapeHtml(idx === 0 ? "-" : leaderGapOf(row) || "-")}</span>` : "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("");
|
||||
|
||||
@@ -62,7 +62,9 @@ test("practice ranked on 3 laps in a row: only result, gap and best lap as times
|
||||
assert.equal(isPracticeRankedSession({ type: "qualification" }), false, "qualifier on laps and time: full view, like a final");
|
||||
assert.equal(isPracticeRankedSession({ type: "final" }), false);
|
||||
const row = { key: "a", driverId: "a", displayName: "Anna", laps: 12, resultDisplay: "3 varv 55.123", gapDisplay: "+0.747s", gapAhead: "+0.2", lapDelta: "-0.1", bestLapMs: 18201, lastLapMs: 18777, predictedRemainingMs: 9000 };
|
||||
const html = renderOverlayLeaderboard([row], deps, { practiceRank: true });
|
||||
// The leader shows "-" as its gap; the gap is checked on the driver behind it.
|
||||
const leader = { key: "l", driverId: "l", displayName: "Lea", laps: 12, resultDisplay: "3 varv 54.376", leaderGap: "Leader", bestLapMs: 18001 };
|
||||
const html = renderOverlayLeaderboard([leader, { ...row, leaderGap: "+0.747s" }], deps, { practiceRank: true });
|
||||
assert.match(html, /overlay-race-list-ranked/);
|
||||
assert.match(html, /pos-pill pos-1">1</);
|
||||
assert.match(html, /<label>table\.result<\/label>\s*<strong>3 varv 55\.123<\/strong>/);
|
||||
@@ -77,3 +79,17 @@ test("a driver's country: a small local flag before the name on the overlay; non
|
||||
assert.match(withFlag, /<img class="country-flag" src="\/src\/flags\/no\.svg"[^>]*\/>Roy/);
|
||||
assert.doesNotMatch(renderOverlayLeaderboard(rows(1), deps), /country-flag/);
|
||||
});
|
||||
|
||||
test("overlay Gap is the gap to the leader and Gap ahead the gap to the car in front", () => {
|
||||
const rows = [
|
||||
{ key: "a", driverId: "a", displayName: "A", laps: 16, resultDisplay: "16/4:47.959", leaderGap: "Leader", gapAhead: "-" },
|
||||
{ key: "b", driverId: "b", displayName: "B", laps: 15, resultDisplay: "15/4:31.848", leaderGap: "+1L", gapAhead: "+1L" },
|
||||
{ key: "c", driverId: "c", displayName: "C", laps: 15, resultDisplay: "15/4:36.430", leaderGap: "+1L", gapAhead: "+4.582s" },
|
||||
];
|
||||
const html = renderOverlayLeaderboard(rows, deps, {});
|
||||
const third = html.slice(html.indexOf('data-overlay-competitor="c"'));
|
||||
assert.match(third, /<label>table\.gap<\/label>\s*<strong>\+1L<\/strong>/);
|
||||
assert.match(third, /<label>table\.ahead_gap<\/label>\s*<strong>\+4\.582s<\/strong>/);
|
||||
const first = html.slice(html.indexOf('data-overlay-competitor="a"'), html.indexOf('data-overlay-competitor="b"'));
|
||||
assert.match(first, /<label>table\.gap<\/label>\s*<strong>-<\/strong>/, "the leader shows -");
|
||||
});
|
||||
Reference in new issue
Block a user