fix(series): report created races, delete a series with its races; group Race Day sessions by today's races (1.43.1)

This commit is contained in:
larssand committed 2026-10-31 08:34:44 +01:00
1 parent 74dbbf6ae0
commit dbda06d101
10 files changed
+133 -13

No files matched your search

+15
View File
@@ -62,6 +62,10 @@ export async function runSeriesSmoke({ evaluate, navigate, savedState, waitFor,
assert.deepEqual(rounds.map((event) => [event.raceConfig.qualifyingScoring, event.raceConfig.countedQualRounds, event.raceConfig.heatOrder]), [["best", 2, "fastest_last"], ["best", 2, "fastest_last"]], "ÖRC Winter is the default format, fastest heat last");
const seedPractices = state.sessions.filter((session) => rounds.some((event) => event.id === session.eventId) && session.type === "practice");
assert.deepEqual(seedPractices.map((session) => [session.durationMin, session.seedBestLapCount, session.seedMethod, session.driverIds.length]), [[5, 3, "consecutive", 0], [5, 3, "consecutive", 0]], "every round starts with a seeding practice that follows the round's drivers");
assert.equal(dialogs.at(-1)?.message, "2 races created. They are listed below and under Race Setup.", "creating says how many races were made");
await evaluate(`(() => { const form = document.getElementById("seriesCreateEvents"); form.elements.dates.value = "2026-11-01"; form.requestSubmit(); })()`);
await waitFor(async () => dialogs.at(-1)?.message.startsWith("No new races were created"), "clicking again for an existing date says so");
assert.equal((await savedState()).series.find((series) => series.id === saved.id).eventIds.length, 2);
console.log("PASS a series is created with club, class and count rule, and its rounds are created from dates");
// The series is the hub for each round: drivers, a late entry, copy to the next round,
@@ -138,6 +142,17 @@ export async function runSeriesSmoke({ evaluate, navigate, savedState, waitFor,
assert.equal(pdf.title, "SR Winter Cup");
assert.deepEqual(pdf.sections[0].rows[0], ["1", "SR Anna", "100", "", "1", "100"]);
console.log("PASS the series PDF export contains the standings");
// Deleting the series asks whether its races go too (the test run accepts both questions).
const seriesSessionIds = (await savedState()).sessions.filter((session) => rounds.some((event) => event.id === session.eventId)).map((session) => session.id);
assert.ok(seriesSessionIds.length > 0);
await evaluate(`document.getElementById("seriesDelete").click()`);
await waitFor(async () => !(await savedState()).series.some((series) => series.id === saved.id), "series deleted");
const afterDelete = await savedState();
assert.equal(afterDelete.events.filter((event) => rounds.some((round) => round.id === event.id)).length, 0, "its races are gone from Race Setup");
assert.equal(afterDelete.sessions.filter((session) => seriesSessionIds.includes(session.id)).length, 0, "with their heats");
assert.ok(dialogs.some((dialog) => dialog.message.startsWith("Also delete the series' 2 races")), "the races are a separate question");
console.log("PASS deleting a series can take its races along");
} finally {
dialogs.splice(dialogsAtStart);
const current = await savedState();