feat(series): ÖRC Winter format, seeding practice and heat order when creating rounds (1.43.0)

This commit is contained in:
larssand committed 2026-10-31 07:58:40 +01:00
1 parent 40c3737925
commit 74dbbf6ae0
10 files changed
+173 -11

No files matched your search

+36 -4
View File
@@ -15,7 +15,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, applyBumpsForRace as applyBumpsForRaceLogic, buildEventSchedule as buildEventScheduleLogic } 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, reseedUpcomingQualifying as reseedUpcomingQualifyingLogic, moveDriversIntoQualifyingHeat as moveDriversIntoQualifyingHeatLogic, parseQualifyingHeatName as parseQualifyingHeatNameLogic, generateFinalsForRace as generateFinalsForRaceLogic, applyBumpsForRace as applyBumpsForRaceLogic, buildEventSchedule as buildEventScheduleLogic, normalizeHeatOrder } from "./event_race_logic.js";
import { 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";
@@ -575,7 +575,7 @@ const getSeriesStandings = (series) => buildSeriesStandings(series, {
classNames: new Map(state.classes.map((item) => [item.id, item.name])),
});
// One race per date and class, named "<series> #<round> <class>", with the chosen race format.
const createSeriesEvents = (series, dates, presetId, format = {}) => {
const createSeriesEvents = (series, dates, presetId, format = {}, { heatOrder = "", seedPractice = false, seedPracticeMin = 5, seedLaps = 3, seedMethod = "consecutive" } = {}) => {
const existingDates = new Set(state.events.filter((event) => series.eventIds.includes(event.id)).map((event) => event.date));
const allDates = [...new Set([...existingDates, ...dates])].sort();
let created = 0;
@@ -587,6 +587,14 @@ const createSeriesEvents = (series, dates, presetId, format = {}) => {
applyRaceFormatPreset(event, presetId);
state.events.push(event);
if (Object.keys(format).length) setSeriesRoundFormat(event.id, format);
if (heatOrder) event.raceConfig.heatOrder = normalizeHeatOrder(heatOrder);
// A practice before qualifying seeds the heats (no driver list: it follows the round's
// participants, set later).
if (seedPractice) {
state.sessions.push(buildRaceSession(event.id, t("series.seed_practice_name"), "practice", Math.max(1, Math.round(seedPracticeMin)), {
startMode: "mass", seedBestLapCount: seedLaps, seedMethod,
}));
}
series.eventIds.push(event.id);
created += 1;
});
@@ -921,7 +929,14 @@ const TRANSLATIONS = {
"series.col_finals": "Finaler",
"series.col_per_heat": "Max bilar/heat",
"series.col_status": "Status",
"series.base_format": "Övrigt format (tider, starttyp)",
"series.base_format": "Format",
"series.seed_practice": "Seedningsträning före kval",
"series.seed_practice_min": "Träning, minuter",
"series.seed_method": "Seedas på",
"series.seed_laps": "Antal varv (N)",
"series.seed_best_lap": "Bästa enskilda varv",
"series.seed_practice_name": "Seedningsträning",
"series.seed_hint": "Varje deltävling får en träning först. \"Generera kval\" delar sedan in heaten efter träningstiderna, så att lika snabba förare kör tillsammans. \"Reseeda kommande kval\" i tävlingen delar om efter kvalrankingen.",
"series.make_qualifying": "Skapa kval",
"series.make_finals": "Skapa finaler",
"series.open_race": "Öppna",
@@ -1776,6 +1791,11 @@ const TRANSLATIONS = {
"events.preset_custom": "Custom / nuvarande värden",
"events.preset_short_technical": "Kort teknisk bana 16s",
"events.preset_club_qualifying": "Klubbrace kval + final",
"events.preset_orc_winter": "ÖRC Winter (3 kval, 6/heat, 3 finaler)",
"events.heat_order": "Heatordning",
"events.heat_order_hint": "Kvalheaten seedas efter practice (sedan kvalrankingen vid reseed). Välj om det snabbaste heatet körs först eller sist.",
"events.heat_order_fastest_last": "Snabbaste heatet sist",
"events.heat_order_fastest_first": "Snabbaste heatet först",
"events.preset_ifmar": "IFMAR-stil kval/final",
"events.preset_endurance": "Endurance / lagrace",
"events.tie_break_note": "Tie-break",
@@ -2763,7 +2783,14 @@ const TRANSLATIONS = {
"series.col_finals": "Finals",
"series.col_per_heat": "Max cars/heat",
"series.col_status": "Status",
"series.base_format": "Other format (times, start mode)",
"series.base_format": "Format",
"series.seed_practice": "Seeding practice before qualifying",
"series.seed_practice_min": "Practice, minutes",
"series.seed_method": "Seed on",
"series.seed_laps": "Number of laps (N)",
"series.seed_best_lap": "Best single lap",
"series.seed_practice_name": "Seeding practice",
"series.seed_hint": "Each round gets a practice first. \"Generate qualifying\" then splits the heats on the practice times, so drivers of equal pace run together. \"Reseed upcoming qualifying\" in the race re-splits on the qualifying standings.",
"series.make_qualifying": "Create qualifying",
"series.make_finals": "Create finals",
"series.open_race": "Open",
@@ -3618,6 +3645,11 @@ const TRANSLATIONS = {
"events.preset_custom": "Custom / current values",
"events.preset_short_technical": "Short technical track 16s",
"events.preset_club_qualifying": "Club race qual + finals",
"events.preset_orc_winter": "ÖRC Winter (3 quals, 6/heat, 3 finals)",
"events.heat_order": "Heat order",
"events.heat_order_hint": "Qualifying heats are seeded from practice (then from the qualifying standings on reseed). Choose whether the fastest heat runs first or last.",
"events.heat_order_fastest_last": "Fastest heat last",
"events.heat_order_fastest_first": "Fastest heat first",
"events.preset_ifmar": "IFMAR-style qual/finals",
"events.preset_endurance": "Endurance / team race",
"events.tie_break_note": "Tie-break",