Add moving a driver between qualifying heats
The user asked whether a lone driver left in the last heat (e.g. 7
drivers at 3 per heat) could be moved into another heat manually.
Investigated first: neither "Reseed" (redistributes every not-yet-run
heat by current standings, not a targeted move) nor the grid editor
(reorders start position within one heat, never moves a driver
between heats) could do this - there was genuinely no path to it.
moveDriversIntoQualifyingHeat (src/event_race_logic.js) adds the same
"checking them elsewhere is the move" pattern already used for team
rosters: a new driver checklist on the qualification session edit
form pulls a checked driver out of whichever other heat they're
currently on, scoped to the same round only ("Q2 H2" never touches
"Q1"/"Q3", since heat composition can legitimately differ round to
round after a reseed). The checklist names the driver's current heat
before saving, mirroring the team-roster warning.
Also confirmed, per the user's earlier questions, already correct
with no changes needed: practice's per-driver "best 3 laps"/"best
5-minute result" stats, and that heats are already seeded fastest-
first from practice results. Flagged one real, deliberately unbuilt
gap while investigating: a true per-driver rolling "5 minutes from
your own first crossing" qualifying *heat* clock isn't supported -
only the practice stats work that way today.
Verified with new unit tests for moveDriversIntoQualifyingHeat and
the extracted parseQualifyingHeatName helper, and a real headless-
browser run reproducing the exact reported scenario end to end
through the actual UI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e9883188fe
commit
b1b65a9cf9
9 files changed
+166
-10
No files matched your search
@@ -19,6 +19,8 @@ export function renderEventManagerView(context) {
|
||||
getTeamDriverPool,
|
||||
getEventTeams,
|
||||
reassignTeamMembers,
|
||||
moveDriversIntoQualifyingHeat,
|
||||
parseQualifyingHeatName,
|
||||
normalizeBrandingConfig,
|
||||
getSessionTypeChoices,
|
||||
getRaceFormatPresets,
|
||||
@@ -168,6 +170,7 @@ export function renderEventManagerView(context) {
|
||||
raceDrivers,
|
||||
teamDriverPool,
|
||||
showTeamsSection,
|
||||
parseQualifyingHeatName,
|
||||
state,
|
||||
getDriverDisplayById,
|
||||
raceFormatAdvanced,
|
||||
@@ -411,6 +414,14 @@ export function renderEventManagerView(context) {
|
||||
: "best_sum";
|
||||
editingSession.staggerGapSec = Math.max(0, Number(form.get("staggerGapSec") || 0) || 0);
|
||||
editingSession.maxCars = Number(form.get("maxCars") || 0) || null;
|
||||
if (selectedType === "qualification") {
|
||||
const heatDriverIds = Array.from(formNode.querySelectorAll('[name="heatDriverIds"]:checked'))
|
||||
.map((node) => String(node.value))
|
||||
.filter(Boolean);
|
||||
moveDriversIntoQualifyingHeat(editingSession.id, heatDriverIds);
|
||||
editingSession.driverIds = heatDriverIds;
|
||||
editingSession.manualGridIds = [...heatDriverIds];
|
||||
}
|
||||
setSelectedSessionEditId(null);
|
||||
saveState();
|
||||
refreshManager();
|
||||
|
||||
Reference in new issue
Block a user