feat(race): practice split into heats by cars per heat; format change rebuilds heats not run yet (1.89.46)

This commit is contained in:
larssand committed 2026-11-16 21:54:06 +01:00
1 parent ce86f771c3
commit 74a2e9ba47
11 files changed
+159 -17

No files matched your search

+9 -3
View File
@@ -33,7 +33,7 @@ import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudio
import { renderRaceFormatField, renderRaceFormatContextCard, getRaceSummaryItems, getRaceSummaryWarnings, renderManageStatusBadge, renderRaceWizardSteps, renderRaceWizardContent, renderRaceStandingsTable } from "./race_setup_ui.js";
import { normalizeRaceTeam as normalizeRaceTeamLogic, normalizeStoredRacePreset as normalizeStoredRacePresetLogic, getRaceFormatPresets as getRaceFormatPresetsLogic, applyRaceFormatPreset as applyRaceFormatPresetLogic, buildRaceFormatConfigFromForm as buildRaceFormatConfigFromFormLogic, normalizeEvent as normalizeEventLogic, normalizeBrandingConfig as normalizeBrandingConfigLogic, resolveEventBranding as resolveEventBrandingLogic, getRaceManageStatuses as getRaceManageStatusesLogic, buildDefaultRaceWizardDraft as buildDefaultRaceWizardDraftLogic, getRaceWizardPreset as getRaceWizardPresetLogic, applyRaceWizardPresetDefaults as applyRaceWizardPresetDefaultsLogic, ensureRaceParticipantsConfigured as ensureRaceParticipantsConfiguredLogic, buildRaceSession as buildRaceSessionLogic, buildOpenPracticeBundle as buildOpenPracticeBundleLogic, buildTrackSession as buildTrackSessionLogic, createSponsorRounds as createSponsorRoundsLogic, buildRaceSessionsFromWizard as buildRaceSessionsFromWizardLogic, getRaceWizardSessionPlan as getRaceWizardSessionPlanLogic, getEventDrivers as getEventDriversLogic, getEventTeams as getEventTeamsLogic, getTeamDriverPool as getTeamDriverPoolLogic, reassignTeamMembers as reassignTeamMembersLogic, findEventTeamForPassing as findEventTeamForPassingLogic, generateQualifyingForRace as generateQualifyingForRaceLogic, reseedUpcomingQualifying as reseedUpcomingQualifyingLogic, moveDriversIntoQualifyingHeat as moveDriversIntoQualifyingHeatLogic, parseQualifyingHeatName as parseQualifyingHeatNameLogic, generateFinalsForRace as generateFinalsForRaceLogic, getRunGeneratedSessions, applyBumpsForRace as applyBumpsForRaceLogic, orderSessionsForRunning, buildEventSchedule as buildEventScheduleLogic, normalizeHeatOrder, planSeedingGroups } from "./event_race_logic.js";
import { normalizeRaceTeam as normalizeRaceTeamLogic, normalizeStoredRacePreset as normalizeStoredRacePresetLogic, getRaceFormatPresets as getRaceFormatPresetsLogic, applyRaceFormatPreset as applyRaceFormatPresetLogic, buildRaceFormatConfigFromForm as buildRaceFormatConfigFromFormLogic, normalizeEvent as normalizeEventLogic, normalizeBrandingConfig as normalizeBrandingConfigLogic, resolveEventBranding as resolveEventBrandingLogic, getRaceManageStatuses as getRaceManageStatusesLogic, buildDefaultRaceWizardDraft as buildDefaultRaceWizardDraftLogic, getRaceWizardPreset as getRaceWizardPresetLogic, applyRaceWizardPresetDefaults as applyRaceWizardPresetDefaultsLogic, ensureRaceParticipantsConfigured as ensureRaceParticipantsConfiguredLogic, buildRaceSession as buildRaceSessionLogic, buildOpenPracticeBundle as buildOpenPracticeBundleLogic, buildTrackSession as buildTrackSessionLogic, createSponsorRounds as createSponsorRoundsLogic, buildRaceSessionsFromWizard as buildRaceSessionsFromWizardLogic, getRaceWizardSessionPlan as getRaceWizardSessionPlanLogic, getEventDrivers as getEventDriversLogic, getEventTeams as getEventTeamsLogic, getTeamDriverPool as getTeamDriverPoolLogic, reassignTeamMembers as reassignTeamMembersLogic, findEventTeamForPassing as findEventTeamForPassingLogic, generateQualifyingForRace as generateQualifyingForRaceLogic, rebuildPracticeHeats as rebuildPracticeHeatsLogic, reseedUpcomingQualifying as reseedUpcomingQualifyingLogic, moveDriversIntoQualifyingHeat as moveDriversIntoQualifyingHeatLogic, parseQualifyingHeatName as parseQualifyingHeatNameLogic, generateFinalsForRace as generateFinalsForRaceLogic, getRunGeneratedSessions, applyBumpsForRace as applyBumpsForRaceLogic, orderSessionsForRunning, buildEventSchedule as buildEventScheduleLogic, normalizeHeatOrder, planSeedingGroups } from "./event_race_logic.js";
import { getFinishWait as getFinishWaitLogic, getSessionTypeLabel as getSessionTypeLabelLogic, getStatusLabel as getStatusLabelLogic, isUntimedSession as isUntimedSessionLogic, getActiveSession as getActiveSessionLogic, getLiveSession as getLiveSessionLogic, getSessionTargetMs as getSessionTargetMsLogic, getSessionLapWindow as getSessionLapWindowLogic, isCountedPassing as isCountedPassingLogic, getVisiblePassings as getVisiblePassingsLogic, getPassingValidationLabel as getPassingValidationLabelLogic, getSessionTiming as getSessionTimingLogic, ensureSessionResult as ensureSessionResultLogic, buildLeaderboard as buildLeaderboardLogic, formatLapDelta as formatLapDeltaLogic, formatLeaderboardGap as formatLeaderboardGapLogic, getCompetitorElapsedMs as getCompetitorElapsedMsLogic, getCompetitorPassings as getCompetitorPassingsLogic, getCompetitorSeedMetric as getCompetitorSeedMetricLogic, getSessionEntrants as getSessionEntrantsLogic, buildPracticeStandings as buildPracticeStandingsLogic, getQualifyingPointsValue as getQualifyingPointsValueLogic, isHighPointsTable as isHighPointsTableLogic, compareNumberSet as compareNumberSetLogic, buildQualifyingTieBreakNote as buildQualifyingTieBreakNoteLogic, hasQualifyingPrimaryTie as hasQualifyingPrimaryTieLogic, buildQualifyingStandings as buildQualifyingStandingsLogic, formatTeamActiveMemberLabel as formatTeamActiveMemberLabelLogic, buildTeamRaceStandings as buildTeamRaceStandingsLogic, buildSessionChannelStats as buildSessionChannelStatsLogic, buildTeamStintLog as buildTeamStintLogLogic, getSessionGridEntries as getSessionGridEntriesLogic, getSessionGridOrder as getSessionGridOrderLogic, ensureSessionDriverOrder as ensureSessionDriverOrderLogic, buildFinalStandings as buildFinalStandingsLogic, getTrackRecordMs as getTrackRecordMsLogic } from "./timing_logic.js";
import { normalizeTrackLayouts, getTrackLayoutIdAt, getTrackLayoutLabel, nextTrackLayoutLabel, findRaceSessionBlockingLayoutChange, isPracticeSessionType, isTrackLayoutInUse } from "./track_layouts_logic.js";
@@ -111,6 +111,7 @@ const reassignTeamMembers = (teams, options) => reassignTeamMembersLogic(teams,
const moveDriversIntoQualifyingHeat = (targetSessionId, driverIds) => moveDriversIntoQualifyingHeatLogic(state.sessions, targetSessionId, driverIds);
const parseQualifyingHeatName = (name) => parseQualifyingHeatNameLogic(name);
const findEventTeamForPassing = (event, driverId, carId) => findEventTeamForPassingLogic(event, driverId, carId, { getEventTeams });
const rebuildPracticeHeats = (event) => rebuildPracticeHeatsLogic(event, { state, t, buildRaceSession });
const generateQualifyingForRace = (event) => generateQualifyingForRaceLogic(event, { buildPracticeStandings, getEventDrivers, state, normalizeStartMode, normalizeSession, uid, chunkArray, clearGeneratedQualifying });
const reseedUpcomingQualifying = (event) => reseedUpcomingQualifyingLogic(event, { buildQualifyingStandings, buildPracticeStandings, getEventDrivers, getSessionsForEvent, chunkArray });
// Names of the generated heats of a race that already ran ("" = none): then they can't be made again.
@@ -2535,7 +2536,7 @@ const TRANSLATIONS = {
"guide.race_wizard_1": "1. Börja i Race Setup och använd wizarden när du skapar ett nytt race, i stället för att bygga allt direkt i Hantera.",
"guide.race_wizard_2": "2. Steg 1 sätter namn, datum, klass och preset. Det finns hela tävlingsdagar som preset (EFRA off-road, touring, 1/8 nitro, ROAR, snabb klubbdag, Rookie/Junior, poängrace utan finaler) - beskrivningen visas under valet. Presetet fyller rimliga standardvärden innan du finjusterar något.",
"guide.race_wizard_3": "3. Steg 2 väljer exakt vilka förare som ska vara med. Listan är grupperad per klass med Alla/Ingen per klass, sök på namn eller transponder och Samma förare som... för att kopiera ett tidigare race. De blir race-specifika deltagare och filter för timing/seedning.",
"guide.race_wizard_4": "4. Steg 3 väljer vilka sessioner som ska skapas direkt: practice, kval och/eller team race beroende på preset.",
"guide.race_wizard_4": "4. Steg 3 väljer vilka sessioner som ska skapas direkt: practice, kval och/eller team race beroende på preset. Practice och kval delas i heat med högst Bilar per heat (12 förare och max 5 → 4 + 4 + 4). Ändrar du Bilar per heat eller antal kvalomgångar under Hantera → Format innan heaten har körts byggs de om av sig själva; heat som redan har körts rörs inte.",
"guide.race_wizard_5": "5. Wizarden skapar de första sessionerna automatiskt, kvalet som heat (Q1 H1, Q1 H2 …). Finaler skapas senare från Race actions när kval eller practice är klara.",
"guide.race_wizard_6": "6. Efter skapandet går du vidare till Hantera för raceformat, generering, grid, standings och utskrift.",
"guide.race_wizard_7": "7. I Hantera -> Race actions kan du exportera eller importera ett enskilt racepaket om du vill flytta just det racet till en annan installation.",
@@ -2648,6 +2649,8 @@ const TRANSLATIONS = {
"events.qualifying_standings": "Kval-ranking",
"events.final_standings": "Final-ranking",
"events.generated_qualifying": "Kvalheat skapade från ranking.",
"events.format_practice_not_rebuilt": "Practice-heaten görs inte om eftersom practice redan har börjat köras – då skulle varv och resultat raderas.",
"events.format_heats_not_rebuilt": "Formatet är sparat, men kvalheaten görs inte om eftersom kvalet redan har börjat köras ({names}) – då skulle varv och resultat raderas. Vill ni ändå göra om dem: tryck först \"Rensa genererade kval\" och sedan \"Skapa kval från practice\".",
"events.finals_generated": "Finaler skapade från ranking.",
"events.finals_already_run": "Finalerna har redan börjat köras ({names}), så de görs inte om – då skulle varv och resultat raderas. Vill ni verkligen göra om dem: tryck först \"Rensa genererade finaler\".",
"events.qualifying_already_run": "Kvalet har redan börjat köras ({names}), så det görs inte om – då skulle varv och resultat raderas. Vill ni verkligen göra om det: tryck först \"Rensa genererade kval\".",
@@ -4960,7 +4963,7 @@ const TRANSLATIONS = {
"guide.race_wizard_1": "1. Start in Race Setup and use the wizard when creating a new race instead of building everything directly in Manage.",
"guide.race_wizard_2": "2. Step 1 sets name, date, class and preset. Whole race days come as presets (EFRA off-road, touring, 1/8 nitro, ROAR, quick club day, Rookie/Junior, points race without finals) - the description shows under the choice. The preset fills sensible defaults before you fine-tune anything.",
"guide.race_wizard_3": "3. Step 2 selects exactly which drivers take part. The list is grouped by class with All/None per class, a search on name or transponder and Same drivers as... to copy an earlier race. They become the race-specific participant scope for timing and seeding.",
"guide.race_wizard_4": "4. Step 3 chooses which sessions should be created immediately: practice, qualifying and/or team race depending on the preset.",
"guide.race_wizard_4": "4. Step 3 chooses which sessions should be created immediately: practice, qualifying and/or team race depending on the preset. Practice and qualifying are split into heats of at most Cars per heat (12 drivers and max 5 → 4 + 4 + 4). If you change Cars per heat or the number of qualifying rounds under Manage → Format before the heats have run, they are built again by themselves; heats that have already run are left alone.",
"guide.race_wizard_5": "5. The wizard creates the initial sessions automatically, qualifying as heats (Q1 H1, Q1 H2 …). Finals are generated later from Race Actions after qualifying or practice is complete.",
"guide.race_wizard_6": "6. After creation, continue in Manage for race format, generation, grid, standings and print/export.",
"guide.race_wizard_7": "7. In Manage -> Race Actions you can export or import a single race package when you want to move just that race to another installation.",
@@ -5073,6 +5076,8 @@ const TRANSLATIONS = {
"events.qualifying_standings": "Qualifying standings",
"events.final_standings": "Final standings",
"events.generated_qualifying": "Qualifying heats generated from standings.",
"events.format_practice_not_rebuilt": "The practice heats are not made again because practice has already started running - that would delete laps and results.",
"events.format_heats_not_rebuilt": "The format is saved, but the qualifying heats are not made again because qualifying has already started running ({names}) - that would delete laps and results. To redo them anyway, press \"Clear generated qualifying\" first and then \"Generate qualifying from practice\".",
"events.finals_generated": "Finals generated from standings.",
"events.finals_already_run": "The finals have already started running ({names}), so they are not made again - that would delete their laps and results. To really redo them, press \"Clear generated finals\" first.",
"events.qualifying_already_run": "Qualifying has already started running ({names}), so it is not made again - that would delete its laps and results. To really redo it, press \"Clear generated qualifying\" first.",
@@ -8308,6 +8313,7 @@ function renderEventManager(eventId) {
applyRaceFormatPreset,
normalizeStoredRacePreset,
generateQualifyingForRace,
rebuildPracticeHeats,
clearGeneratedQualifying,
reseedUpcomingQualifying,
generateFinalsForRace,