feat(series): correct a round's result by hand (1.48.0)

This commit is contained in:
larssand committed 2026-11-01 19:50:20 +01:00
1 parent 6142bceca9
commit e199f3aa1a
11 files changed
+178 -14

No files matched your search

+32 -6
View File
@@ -9,7 +9,7 @@ import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologu
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay, refreshRaceDayLive } from "./race_day_view.js";
import { beginSession as beginSessionControl, finishSession as finishSessionControl, pauseSession as pauseSessionControl, resumeSession as resumeSessionControl } from "./session_control.js";
import { normalizeSeries, buildSeriesStandings, getSeriesRoundStatus, getSeriesRoundNextStep } from "./series_logic.js";
import { normalizeSeries, buildSeriesStandings, getSeriesRoundStatus, getSeriesRoundNextStep, getSeriesDayResult } from "./series_logic.js";
import { renderSeriesView } from "./series_view.js";
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace } from "./race_audio.js";
@@ -159,8 +159,9 @@ const hydrateFromBackend = ({ initial = false } = {}) => hydrateFromBackendHelpe
// The first load at page start always takes the server's state.
...(initial ? {} : { getLocalStateVersion: () => localStateVersion, getLocalStateDirty: () => localStateDirty, keepLocal: isRunningRaceHere }),
});
// This browser is starting or timing a heat: its own state is the newest.
const isRunningRaceHere = () => Boolean(getPrologueSession() || pendingStartSessionId || startsInProgress > 0
// This browser is starting or timing a heat: its own state is the newest. A stand-alone
// overlay window only shows the race, so it always follows the server.
const isRunningRaceHere = () => !overlayMode && Boolean(getPrologueSession() || pendingStartSessionId || startsInProgress > 0
|| (state.decoder?.connected && state.sessions.some((session) => ["running", "paused"].includes(session.status))));
const scheduleBackendSync = () => scheduleBackendSyncHelper({ getBackendSyncTimer: () => backendSyncTimer, setBackendSyncTimer: (value) => { backendSyncTimer = value; }, syncStateToBackend });
const syncStateToBackend = () => syncStateToBackendHelper({ backend, t, getBackendUrl, buildPersistableState, getLocalStateVersion: () => localStateVersion, getSyncedStateVersion: () => syncedStateVersion, setSyncedStateVersion: (value) => { syncedStateVersion = value; }, getLocalStateDirty: () => localStateDirty, setLocalStateDirty: (value) => { localStateDirty = value; } });
@@ -589,9 +590,10 @@ const getEventDayResult = (event) => {
buildQualifyingStandings(event).forEach(add);
return order;
};
const getDriverNameById = (driverId) => state.drivers.find((driver) => driver.id === driverId)?.name || "";
const getSeriesStandings = (series) => buildSeriesStandings(series, {
events: state.events,
dayResults: new Map(state.events.filter((event) => series.eventIds.includes(event.id)).map((event) => [event.id, getEventDayResult(event)])),
dayResults: new Map(state.events.filter((event) => series.eventIds.includes(event.id)).map((event) => [event.id, getSeriesDayResult(series, event.id, getEventDayResult(event), getDriverNameById)])),
getDriverClub: (driverId) => state.drivers.find((driver) => driver.id === driverId)?.club || "",
getDriverName: (driverId) => state.drivers.find((driver) => driver.id === driverId)?.name || "",
classNames: new Map(state.classes.map((item) => [item.id, item.name])),
@@ -642,6 +644,8 @@ const getSeriesRounds = (series) => state.events
nextStep: getSeriesRoundNextStep(sessions),
qualHeatCount: new Set(qualSessions.map((session) => String(session.name || "").split(" ").pop())).size,
finalCount: sessions.filter((session) => session.type === "final").length,
calculatedResult: getEventDayResult(event),
manualResult: series.manualResults?.[event.id] || null,
};
});
// Deleting a series can take its rounds along (races in another series are kept).
@@ -1032,6 +1036,17 @@ const TRANSLATIONS = {
"series.make_qualifying": "Skapa kval",
"series.make_finals": "Skapa finaler",
"series.open_race": "Öppna",
"series.result_button": "Resultat",
"series.result_title": "Rätta deltävlingens resultat",
"series.result_hint": "Sätt rätt slutordning för dagen, vinnaren först. Den ersätter appens uträkning i ställningen, t.ex. när kvalet blev fel. Förare som inte står med får inga poäng för deltävlingen.",
"series.result_up": "Flytta upp",
"series.result_down": "Flytta ned",
"series.result_remove": "Ta bort",
"series.result_add": "Lägg till förare",
"series.result_save": "Spara resultat",
"series.result_clear": "Använd appens resultat",
"series.result_clear_confirm": "Ta bort det rättade resultatet och räkna deltävlingen från heaten igen?",
"series.result_manual": "Rättat resultat",
"series.remove_round": "Ta bort ur serien (racet finns kvar)",
"series.remove_round_confirm": "Ta bort deltävlingen ur serien? Racet och dess resultat finns kvar.",
"series.no_participants": "Välj minst en förare först (klicka på antalet förare).",
@@ -1729,7 +1744,7 @@ const TRANSLATIONS = {
"guide.series_day_3": "3. Ändra vid behov antal kval, finaler och max bilar per heat för just den deltävlingen - det kan skilja mellan deltävlingar och klasser.",
"guide.series_day_4": "4. Knappen på raden visar nästa steg. Börja med ▶ Seedningsträning: den delar dagens förare i seedningsgrupper (max enligt kolumnen Max förare/seedgrupp, efter serieställningen - första deltävlingen i anmälningsordning), väljer första gruppen och öppnar Race Day - tryck Starta. Sedan ▶ Seedningsträning 2 osv. Grupperna delas om tills första gruppen startat, så efteranmälda kommer med.",
"guide.series_day_5": "5. Skapa kval: heaten delas efter träningstiderna (lika snabba tillsammans, snabbaste heatet sist) och jämnt efter fältet (9 förare, max 6 -> 5 + 4). Sedan visar raden ▶ Kör Q1 H1, Q1 H2 ... och på Race Day väljer ▶ Nästa nästa heat. Reseeda kommande kval (i racet under Race Setup) delar om efter kvalrankingen.",
"guide.series_day_6": "6. När kvalet är klart: Skapa finaler, sedan ▶ Kör C Final 1, B Final 1, A Final 1, C Final 2 ... Status visar var deltävlingen är. Öppna tar dig till racet i Race Setup. Ställningen i steg 4 uppdateras av sig själv.",
"guide.series_day_6": "6. När kvalet är klart: Skapa finaler, sedan ▶ Kör C Final 1, B Final 1, A Final 1, C Final 2 ... Status visar var deltävlingen är. Öppna tar dig till racet i Race Setup. Ställningen i steg 4 uppdateras av sig själv. Blev något fel (t.ex. kvalet)? ✎ Resultat på raden sätter dagens slutordning för hand, och ställningen följer den.",
"guide.series_points_title": "Poäng och ställning",
"guide.series_points_1": "Dagens placering i en deltävling: slutresultatet (A-final före B-final), sedan förare utan final i kvalordning. Utan finaler används kvalordningen.",
"guide.series_points_2": "Endast klubbmedlemmar: förare från andra klubbar kör och syns i dagens resultat men får inga poäng, och medlemmarna rangordnas om utan dem.",
@@ -2916,6 +2931,17 @@ const TRANSLATIONS = {
"series.make_qualifying": "Create qualifying",
"series.make_finals": "Create finals",
"series.open_race": "Open",
"series.result_button": "Result",
"series.result_title": "Correct the round's result",
"series.result_hint": "Set the right finishing order for the day, winner first. It replaces the calculated result in the standings, e.g. when the qualifying went wrong. Drivers not listed get no points for the round.",
"series.result_up": "Move up",
"series.result_down": "Move down",
"series.result_remove": "Remove",
"series.result_add": "Add driver",
"series.result_save": "Save result",
"series.result_clear": "Use the calculated result",
"series.result_clear_confirm": "Remove the corrected result and score the round from its heats again?",
"series.result_manual": "Corrected result",
"series.remove_round": "Remove from the series (the race is kept)",
"series.remove_round_confirm": "Remove the round from the series? The race and its results are kept.",
"series.no_participants": "Pick at least one driver first (click the number of drivers).",
@@ -3613,7 +3639,7 @@ const TRANSLATIONS = {
"guide.series_day_3": "3. Change qualifying rounds, finals and max cars per heat for that round if needed - it can differ between rounds and classes.",
"guide.series_day_4": "4. The button on the row shows the next step. Start with ▶ Seeding practice: it splits today's drivers into seeding groups (max per the Max drivers/seed group column, on the series standings - entry order in the first round), selects the first group and opens Race Day - press Start. Then ▶ Seeding practice 2 and so on. The groups are re-split until the first one has started, so late entries are included.",
"guide.series_day_5": "5. Create qualifying: the heats are split on the practice times (equal pace together, fastest heat last) and evenly by the field (9 drivers, max 6 -> 5 + 4). The row then shows ▶ Run Q1 H1, Q1 H2 ... and on Race Day ▶ Next selects the next heat. Reseed upcoming qualifying (in the race under Race Setup) re-splits on the qualifying standings.",
"guide.series_day_6": "6. When qualifying is done: Create finals, then ▶ Run C Final 1, B Final 1, A Final 1, C Final 2 ... Status shows where the round is. Open goes to the race in Race Setup. The standings in step 4 update by themselves.",
"guide.series_day_6": "6. When qualifying is done: Create finals, then ▶ Run C Final 1, B Final 1, A Final 1, C Final 2 ... Status shows where the round is. Open goes to the race in Race Setup. The standings in step 4 update by themselves. Did something go wrong (e.g. the qualifying)? ✎ Result on the row sets the day's finishing order by hand, and the standings follow it.",
"guide.series_points_title": "Points and standings",
"guide.series_points_1": "A round's placing: the final standings (A final before B final), then drivers without a final in qualifying order. Without finals, the qualifying order is used.",
"guide.series_points_2": "Members only: drivers from other clubs race and appear in the day result but get no points, and members are re-ranked without them.",