feat(series): choose open series or club members only for series points

Who scores is now an explicit per-series choice: every driver (default)
or club members only, with the club field shown only for the latter.
Series saved with a club keep members-only scoring. README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Opus 5.5 committed 2026-10-11 18:12:18 +02:00
1 parent efa082c2b5
commit ec200aef2b
11 files changed
+77 -16

No files matched your search

+6 -3
View File
@@ -4,8 +4,8 @@
//
// Rules supported (see ROADMAP "Series / cup"):
// - points per place from a table, then a fixed step down to a minimum for later places;
// - only drivers from the series' club score (others still race and appear in the day
// result); club drivers are re-ranked without them;
// - who scores: every driver (open series), or only members of the series' club - others
// still race and appear in the day result, and members are re-ranked without them;
// - a driver with no registered lap in the event gets 0 points and no place;
// - count the best N results, or all completed events minus X (so a cancelled event
// reduces the count automatically);
@@ -37,6 +37,9 @@ export function normalizeSeries(series = {}, { uid } = {}) {
id: String(series.id || (uid ? uid("series") : "")),
name: String(series.name || "").trim(),
club: String(series.club || "").trim(),
// "all" = every driver scores; "club" = only drivers whose club matches. Series saved before
// this choice existed keep their behaviour: a club filled in meant members only.
scoring: series.scoring === "club" || (series.scoring === undefined && String(series.club || "").trim()) ? "club" : "all",
classIds: Array.isArray(series.classIds) ? [...new Set(series.classIds.map(String).filter(Boolean))] : [],
eventIds: Array.isArray(series.eventIds) ? [...new Set(series.eventIds.map(String).filter(Boolean))] : [],
pointsTable: table.length ? table : preset.table.slice(),
@@ -67,7 +70,7 @@ export function scoreSeriesEvent(series, dayResult, { getDriverClub = () => "" }
let place = 0;
(dayResult || []).forEach((row) => {
if (!row?.driverId || scored.has(row.driverId)) return;
if (series.club && !sameClub(getDriverClub(row.driverId), series.club)) return;
if (series.scoring === "club" && series.club && !sameClub(getDriverClub(row.driverId), series.club)) return;
if (!row.hasLap) {
scored.set(row.driverId, { place: null, points: 0, driverName: row.driverName });
return;