fix(race): a changed qualifying ranking also re-ranks qualifiers already run (1.89.13)
This commit is contained in:
1 parent
4a1460b480
commit
1b968bc275
7 files changed
+28
-6
No files matched your search
@@ -1150,6 +1150,9 @@ export function buildEventSchedule(event, sessions) {
|
||||
// A changed race format reaches the sessions not run yet: when e.g. "qualifying time" goes
|
||||
// 5 -> 3 min, every ready practice/qualifying session gets 3 min. Only fields whose format
|
||||
// value changed are applied, so a heat edited by hand keeps its own other values.
|
||||
// How a heat is ranked (best N laps, method) only decides its result, which is worked out from
|
||||
// the laps each time: a wrong choice fixed afterwards also re-ranks heats already run.
|
||||
const RANKING_ONLY_KEYS = new Set(["qualSeedLapCount", "qualSeedMethod"]);
|
||||
export function applyFormatToPendingSessions(sessions, before = {}, after = {}) {
|
||||
const fields = {
|
||||
practice: [["qualDurationMin", "durationMin"]],
|
||||
@@ -1158,9 +1161,10 @@ export function applyFormatToPendingSessions(sessions, before = {}, after = {})
|
||||
};
|
||||
let changed = 0;
|
||||
sessions.forEach((session) => {
|
||||
if (session.status !== "ready" || session.startedAt) return;
|
||||
const pending = session.status === "ready" && !session.startedAt;
|
||||
let touched = false;
|
||||
(fields[session.type] || []).forEach(([configKey, sessionKey]) => {
|
||||
if (!pending && !RANKING_ONLY_KEYS.has(configKey)) return;
|
||||
if (after[configKey] === undefined || after[configKey] === before[configKey]) return;
|
||||
session[sessionKey] = after[configKey];
|
||||
touched = true;
|
||||
|
||||
Reference in new issue
Block a user