feat(series): correct a round's result by hand (1.48.0)

This commit is contained in:
larssand committed 2026-11-01 19:50:20 +01:00
1 parent 6142bceca9
commit e199f3aa1a
11 files changed
+178 -14

No files matched your search

+10
View File
@@ -42,3 +42,13 @@ test("seeding groups: even split by max size, top of the standings last with fas
const fifty = Array.from({ length: 50 }, (_, index) => `x${index}`);
assert.deepEqual(planSeedingGroups(fifty, 6, "fastest_first").map((group) => group.length), [6, 6, 6, 6, 6, 5, 5, 5, 5]);
});
test("a round's hand-set result replaces the calculated one in the standings", async () => {
const { normalizeSeries, getSeriesDayResult } = await import("../src/series_logic.js");
const series = normalizeSeries({ id: "s", manualResults: { e1: ["roy", "wilmer", "roy", ""], e2: [] } });
assert.deepEqual(series.manualResults, { e1: ["roy", "wilmer"] }, "duplicates and empty lists are dropped");
const calculated = [{ driverId: "patrik", driverName: "Patrik", hasLap: true }, { driverId: "roy", driverName: "Roy", hasLap: true }];
const names = { roy: "Roy Gjemble", wilmer: "Wilmer Nilsson" };
assert.deepEqual(getSeriesDayResult(series, "e1", calculated, (id) => names[id]).map((row) => row.driverName), ["Roy Gjemble", "Wilmer Nilsson"]);
assert.equal(getSeriesDayResult(series, "e2", calculated), calculated, "no hand-set order: the calculated result");
});