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:
@@ -25,6 +25,18 @@ test("only club members score; they are re-ranked without guests; no lap means 0
|
||||
assert.equal(scoreSeriesEvent(open, [{ driverId: "guest", hasLap: true }]).get("guest").points, 100, "no club set: everyone scores");
|
||||
});
|
||||
|
||||
test("who scores is an explicit choice: an open series counts every driver even with a club filled in", () => {
|
||||
const clubs = { member: "Östersunds RC", guest: "Other RC" };
|
||||
const day = [{ driverId: "guest", hasLap: true }, { driverId: "member", hasLap: true }];
|
||||
const open = normalizeSeries({ club: "Östersunds RC", scoring: "all" });
|
||||
assert.equal(open.scoring, "all");
|
||||
assert.equal(scoreSeriesEvent(open, day, { getDriverClub: (id) => clubs[id] }).get("guest").points, 100);
|
||||
const members = normalizeSeries({ club: "Östersunds RC", scoring: "club" });
|
||||
assert.equal(scoreSeriesEvent(members, day, { getDriverClub: (id) => clubs[id] }).get("member").points, 100);
|
||||
assert.equal(normalizeSeries({}).scoring, "all", "new series are open by default");
|
||||
assert.equal(normalizeSeries({ club: "Östersunds RC" }).scoring, "club", "a series saved with a club before the choice existed stays members-only");
|
||||
});
|
||||
|
||||
test("best N, or completed minus X (so a cancelled event lowers the count)", () => {
|
||||
assert.equal(getCountedResultsCount(orc, 12), 9);
|
||||
assert.equal(getCountedResultsCount(orc, 4), 4);
|
||||
|
||||
Reference in New Issue
Block a user