fix(archive): name the winner from the session result, not the raw lap count (1.47.1)
This commit is contained in:
1 parent
54487a18a6
commit
6142bceca9
5 files changed
+29
-8
No files matched your search
@@ -12,3 +12,18 @@ test("estimated finish: laps and time when a 5-minute heat is up, at the car's r
|
||||
assert.equal(estimateFinish({ laps: 0, totalElapsedMs: 0 }, 300000), null, "no lap yet");
|
||||
assert.equal(estimateFinish({ laps: 5, totalElapsedMs: 90000 }, null), null, "untimed session");
|
||||
});
|
||||
|
||||
test("results archive: the winner is the session's result order, not who has a lap stored first", async () => {
|
||||
const { buildArchiveRows } = await import("../src/results_archive_view.js");
|
||||
const state = {
|
||||
sessions: [{ id: "a1", eventId: "e1", name: "A final 1", status: "finished", endedAt: 1 }],
|
||||
events: [{ id: "e1", classId: "c1", date: "2026-11-01" }],
|
||||
resultsBySession: { a1: { competitors: { first_over_line: { driverName: "Crossed first", laps: 14 }, winner: { driverName: "Finished first", laps: 14 } } } },
|
||||
trackLayouts: [],
|
||||
};
|
||||
const rows = buildArchiveRows(state, {
|
||||
getEventName: () => "Race", getClassName: () => "2WD", getTrackLayoutLabel: () => "",
|
||||
buildLeaderboard: () => [{ driverName: "Finished first" }, { driverName: "Crossed first" }],
|
||||
});
|
||||
assert.equal(rows[0].winnerName, "Finished first");
|
||||
});
|
||||
Reference in new issue
Block a user