feat(judging): judge finished heats, DSQ/DNF, reasons, own time and driver calls per EFRA (1.70.0)
This commit is contained in:
1 parent
2e3676d0cd
commit
be99cfaab2
17 files changed
+399
-25
No files matched your search
@@ -8,6 +8,12 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.70.0
|
||||
|
||||
- Judging after the race: pick any run heat, qualifier or final under "Heat to judge" (not only the active one) to give penalties after a protest or a technical check. Results, qualifying and final standings, the race overview and the archive follow at once; a warning shows when the finals were already made from qualifying.
|
||||
- Penalties take a reason (logged and exported), and an own time (e.g. +10 s). New DSQ and DNF: DSQ classifies the driver last (in qualifying: last-place points for that round, its laps out of the tie-breaks - EFRA), DNF keeps the laps and is shown as DNF. Everything can be undone in the judging log.
|
||||
- Calls to the driver while the heat runs (EFRA 9): Attention (blue flag), Official warning, Stop & go and Drive through - called out by the speaker with the driver's name and logged; two official warnings offer a DSQ. Time penalties are no longer called out after the race.
|
||||
|
||||
## 1.69.1
|
||||
|
||||
- Guide and README brought up to date: team race setup, race overview, the results archive per race, Open Practice settings and ranking, the speaker panel on Race Day and Judging, the sponsor event flow, practice and leader calls, and a new guide section "Testing without a decoder" for the simulator and the test-data/ files.
|
||||
|
||||
@@ -138,7 +138,7 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create
|
||||
|
||||
**Timing** shows the live leaderboard (laps, gap to leader and ahead, own delta, best and last lap), recent passings with invalid short laps marked, the grid for position starts, and a session replay (1-10x).
|
||||
|
||||
**Judging** has the speaker panel on top and is where race corrections are made: ±laps, ±seconds and reset, plus removing or restoring any lap. Everything is logged with time and can be undone; the log exports as JSON. In qualifying, heats and finals this is the only place for penalties; Timing shows the corrections and has an **Open in Judging** button. Practice has no penalties, but laps can be cleaned up right on Timing (see [practice](#practice-and-training-statistics)).
|
||||
**Judging** has the speaker panel on top and is where race corrections are made - also after a heat, qualifier or final is finished (a protest, a car found illegal): pick the heat under **Heat to judge**. Penalties take a **reason** that is logged; there is an own time (e.g. +10 s), **DSQ** (classified last; in qualifying last-place points, as in EFRA) and **DNF**. While the heat runs, **Calls to the driver** - Attention (blue flag), Official warning, Stop & go, Drive through - are called out by the speaker and logged; two official warnings offer a DSQ (EFRA). Results, standings, the race overview and the archive update at once; if the finals were already made from qualifying, Judging warns. Also: ±laps, ±seconds and reset, plus removing or restoring any lap. Everything is logged with time and can be undone; the log exports as JSON. In qualifying, heats and finals this is the only place for penalties; Timing shows the corrections and has an **Open in Judging** button. Practice has no penalties, but laps can be cleaned up right on Timing (see [practice](#practice-and-training-statistics)).
|
||||
|
||||
Lap validation:
|
||||
- **Min lap time** rejects shortcuts and false hits.
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ Gränssnittet finns på svenska och engelska.
|
||||
|
||||
**Tidtagning** visar livetopplistan (varv, gap till ledaren och framför, eget delta, bästa och senaste varv), senaste passeringar med ogiltiga korta varv markerade, grid vid positionsstart, och repris av sessionen (1-10x).
|
||||
|
||||
**Domare** har speakerpanelen överst och är platsen för korrigeringar i race: ±varv, ±sekunder och nollställ, samt ta bort eller återställa vilket varv som helst. Allt loggas med tid och kan ångras; loggen kan exporteras som JSON. I kval, heat och final är Domarvyn enda stället för straff; Tidtagning visar korrigeringarna och har knappen **Öppna i Domarvyn**. Träning har inga straff, men varv kan städas direkt i Tidtagning (se [träning](#träning-och-träningsstatistik)).
|
||||
**Domare** har speakerpanelen överst och är platsen för korrigeringar i race – även efter att ett heat, kval eller final är klart (protest, ej godkänd bil): välj heatet under **Heat att döma**. Straff får en **orsak** som loggas; det finns egen tid (t.ex. +10 s), **DSQ** (placeras sist; i kval poäng som sista plats, enligt EFRA) och **DNF**. Medan heatet pågår finns **Utrop till föraren** – Observera (blå flagg), Officiell varning, Stop & go, Drive through – som speakern ropar ut och som loggas; två officiella varningar ger förslag på DSQ (EFRA). Resultat, ställning, race-översikt och arkiv räknas om direkt; är finalerna redan skapade från kvalet varnar Domarvyn. Dessutom: ±varv, ±sekunder och nollställ, samt ta bort eller återställa vilket varv som helst. Allt loggas med tid och kan ångras; loggen kan exporteras som JSON. I kval, heat och final är Domarvyn enda stället för straff; Tidtagning visar korrigeringarna och har knappen **Öppna i Domarvyn**. Träning har inga straff, men varv kan städas direkt i Tidtagning (se [träning](#träning-och-träningsstatistik)).
|
||||
|
||||
Varvkontroll:
|
||||
- **Minsta varvtid** stoppar genvägar och falska träffar.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.69.1",
|
||||
"version": "1.70.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.69.1",
|
||||
"version": "1.70.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.11.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.69.1",
|
||||
"version": "1.70.0",
|
||||
"private": true,
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
"engines": {
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
"stop_and_go": { "effect": "effects/warning.wav" },
|
||||
"drive_through": { "effect": "effects/warning.wav" },
|
||||
"disqualified": { "effect": "effects/warning.wav" },
|
||||
"driver_attention": { "effect": "effects/warning.wav" },
|
||||
"official_warning": { "effect": "effects/warning.wav" },
|
||||
"pit_speed_warning": { "effect": "effects/warning.wav" },
|
||||
"timing_disconnected": { "effect": "effects/warning.wav" },
|
||||
"unknown_transponder": { "effect": "effects/warning.wav" },
|
||||
@@ -73,7 +75,7 @@
|
||||
"track_call": "Track call. Track call.", "track_clear": "Track is clear.", "yellow_flag": "Yellow flag.", "red_flag": "Red flag. Stop all cars.",
|
||||
"race_paused": "Race paused.", "race_resumed": "Race resumed.", "marshal_warning": "Marshal warning.",
|
||||
"marshal_required": "Marshal required at post {marshalPost}.", "penalty": "Penalty for {driverName}.",
|
||||
"stop_and_go": "Stop and go penalty for {driverName}.", "drive_through": "Drive through penalty for {driverName}.", "disqualified": "{driverName} is disqualified.",
|
||||
"stop_and_go": "Stop and go penalty for {driverName}.", "drive_through": "Drive through penalty for {driverName}.", "disqualified": "{driverName} is disqualified.", "driver_attention": "Attention, {driverName}. Let the faster car through.", "official_warning": "Official warning for {driverName}.",
|
||||
"pit_lane_open": "Pit lane is open.", "pit_lane_closed": "Pit lane is closed.", "pit_speed_warning": "Pit lane speed warning for {driverName}.",
|
||||
"qualifying_start": "Qualifying is starting.", "qualifying_remaining": "Qualifying time remaining: {time}.", "qualifying_finished": "Qualifying is finished.",
|
||||
"provisional_pole": "Provisional pole. {driverName}.", "pole_position": "Pole position. {driverName}.",
|
||||
@@ -113,7 +115,7 @@
|
||||
"track_call": "Stopp på banan. Stopp på banan.", "track_clear": "Banan är fri.", "yellow_flag": "Gul flagg.", "red_flag": "Röd flagg. Stoppa alla bilar.",
|
||||
"race_paused": "Racet är pausat.", "race_resumed": "Racet fortsätter.", "marshal_warning": "Varning till banvakt.",
|
||||
"marshal_required": "Banvakt behövs vid post {marshalPost}.", "penalty": "Bestraffning för {driverName}.",
|
||||
"stop_and_go": "Stop and go för {driverName}.", "drive_through": "Drive through för {driverName}.", "disqualified": "{driverName} är diskvalificerad.",
|
||||
"stop_and_go": "Stop and go för {driverName}.", "drive_through": "Drive through för {driverName}.", "disqualified": "{driverName} är diskvalificerad.", "driver_attention": "Observera, {driverName}. Släpp förbi den snabbare bilen.", "official_warning": "Officiell varning till {driverName}.",
|
||||
"pit_lane_open": "Depån är öppen.", "pit_lane_closed": "Depån är stängd.", "pit_speed_warning": "Varning för hög fart i depån för {driverName}.",
|
||||
"qualifying_start": "Kvalet startar.", "qualifying_remaining": "Kvaltid kvar: {time}.", "qualifying_finished": "Kvalet är avslutat.",
|
||||
"provisional_pole": "Preliminär pole. {driverName}.", "pole_position": "Pole position. {driverName}.",
|
||||
|
||||
+83
-6
@@ -49,6 +49,7 @@ import { createSessionReplayRuntime } from "./session_replay.js";
|
||||
|
||||
import { renderTeamStintLog as renderTeamStintLogHelper, renderSessionChannelAnalysis as renderSessionChannelAnalysisHelper, renderTeamRaceStandings as renderTeamRaceStandingsHelper, getSessionSortWeight as getSessionSortWeightHelper, getDriverDisplayById as getDriverDisplayByIdHelper, renderPositionGrid as renderPositionGridHelper, renderGridEditor as renderGridEditorHelper, getFinalMainLayouts as getFinalMainLayoutsHelper, renderFinalMatrix as renderFinalMatrixHelper, buildPrintBrandBlock as buildPrintBrandBlockHelper, buildRaceStartListsHtml as buildRaceStartListsHtmlHelper, buildRaceResultsHtml as buildRaceResultsHtmlHelper, buildTeamRaceResultsHtml as buildTeamRaceResultsHtmlHelper } from "./race_render_helpers.js";
|
||||
|
||||
import { setCompetitorRaceStatus as setCompetitorRaceStatusLogic, logRaceControlCall, countOfficialWarnings } from "./judging_logic.js";
|
||||
import { setCompetitorLapStatus as setCompetitorLapStatusLogic, getManualCorrectionSummary as getManualCorrectionSummaryLogic, applyCompetitorCorrection as applyCompetitorCorrectionLogic, recalculateCompetitorFromPassings as recalculateCompetitorFromPassingsLogic, invalidateCompetitorLastLap as invalidateCompetitorLastLapLogic, restoreCompetitorLastInvalidLap as restoreCompetitorLastInvalidLapLogic, findPassingByUndoMarker as findPassingByUndoMarkerLogic, undoJudgingAdjustment as undoJudgingAdjustmentLogic, getJudgeFilteredRows as getJudgeFilteredRowsLogic, getJudgeFilteredLog as getJudgeFilteredLogLogic } from "./judging_logic.js";
|
||||
|
||||
const PRODUCT_NAME = "RC RaceCore";
|
||||
@@ -803,7 +804,9 @@ const speakerPanelDeps = {
|
||||
renderSpeakerPanel: () => renderSpeakerPanel({ state, t, escapeHtml }),
|
||||
bindSpeakerPanel: (root) => bindSpeakerPanel(root, { state, getActiveSession, cancelRaceStart, triggerRaceAudio, saveState, updateHeaderState, renderView }),
|
||||
};
|
||||
const renderJudging = () => renderJudgingView({ ...speakerPanelDeps, state, dom, t, escapeHtml, formatLap, renderTable, getActiveSession, ensureSessionResult, buildLeaderboard, getSessionTypeLabel, getJudgeFilteredRows, getJudgeFilteredLog, getCompetitorPassings, isCountedPassing, getPassingValidationLabel, undoJudgingAdjustment, applyCompetitorCorrection, invalidateCompetitorLastLap, restoreCompetitorLastInvalidLap, renderView, getSelectedJudgeKey: () => selectedJudgeKey, setSelectedJudgeKey: (value) => { selectedJudgeKey = value; }, getJudgingCompetitorFilter: () => judgingCompetitorFilter, setJudgingCompetitorFilter: (value) => { judgingCompetitorFilter = value; }, getJudgingLogFilter: () => judgingLogFilter, setJudgingLogFilter: (value) => { judgingLogFilter = value; } , setCompetitorLapStatus });
|
||||
const renderJudging = () => renderJudgingView({ ...speakerPanelDeps,
|
||||
getJudgingSession, setJudgingSessionId: (value) => { judgingSessionId = value; }, getJudgingSessionChoices,
|
||||
setCompetitorRaceStatus, callRaceControl, countOfficialWarnings, hasFinalsFromQualifying, state, dom, t, escapeHtml, formatLap, renderTable, getActiveSession, ensureSessionResult, buildLeaderboard, getSessionTypeLabel, getJudgeFilteredRows, getJudgeFilteredLog, getCompetitorPassings, isCountedPassing, getPassingValidationLabel, undoJudgingAdjustment, applyCompetitorCorrection, invalidateCompetitorLastLap, restoreCompetitorLastInvalidLap, renderView, getSelectedJudgeKey: () => selectedJudgeKey, setSelectedJudgeKey: (value) => { selectedJudgeKey = value; }, getJudgingCompetitorFilter: () => judgingCompetitorFilter, setJudgingCompetitorFilter: (value) => { judgingCompetitorFilter = value; }, getJudgingLogFilter: () => judgingLogFilter, setJudgingLogFilter: (value) => { judgingLogFilter = value; } , setCompetitorLapStatus });
|
||||
const normalizeTrainingState = (training) => normalizeTrainingStateLogic(training, { uid });
|
||||
const syncTrainingLedger = () => {
|
||||
state.training = syncTrainingLedgerLogic(state.training, state, { uid });
|
||||
@@ -1054,7 +1057,8 @@ const saveCorrectionFor = (session) => () => {
|
||||
};
|
||||
const applyCompetitorCorrection = (session, row, options = {}) => {
|
||||
const result = applyCompetitorCorrectionLogic(session, row, options, { ensureSessionResult, uid, t, formatLap, saveState: saveCorrectionFor(session) });
|
||||
if (!options.reset && ((Number(options.timeMsDelta || 0) > 0) || (Number(options.lapDelta || 0) < 0))) {
|
||||
// Called out only while the heat runs - a penalty after the race is just written down.
|
||||
if (!options.reset && ["running", "paused"].includes(session?.status) && ((Number(options.timeMsDelta || 0) > 0) || (Number(options.lapDelta || 0) < 0))) {
|
||||
triggerRaceAudio("penalty", { variables: { driverName: row?.displayName || row?.driverName || "" }, driverId: row?.driverId, logData: { raceId: session?.eventId, driverId: row?.driverId } });
|
||||
}
|
||||
return result;
|
||||
@@ -1081,6 +1085,32 @@ const restoreCompetitorLastInvalidLap = (session, row) => restoreCompetitorLastI
|
||||
const findPassingByUndoMarker = (session, rowKey, passingTimestamp) => findPassingByUndoMarkerLogic(session, rowKey, passingTimestamp, { ensureSessionResult });
|
||||
const undoJudgingAdjustment = (session, adjustmentId) => undoJudgingAdjustmentLogic(session, adjustmentId, { ensureSessionResult, findPassingByUndoMarker, recalculateCompetitorFromPassings, uid, t, saveState: saveCorrectionFor(session) });
|
||||
const getJudgeFilteredRows = (rows, filterValue) => getJudgeFilteredRowsLogic(rows, filterValue);
|
||||
// Judging: DSQ / DNF, race-control calls to one driver, and which heat is judged.
|
||||
const setCompetitorRaceStatus = (session, row, status, options = {}) => {
|
||||
const changed = setCompetitorRaceStatusLogic(session, row, status, options, { ensureSessionResult, uid, t, saveState: saveCorrectionFor(session) });
|
||||
if (changed && status === "dsq" && ["running", "paused"].includes(session?.status)) {
|
||||
triggerRaceAudio("disqualified", { force: true, interrupt: true, variables: { driverName: row?.displayName || row?.driverName || "" }, driverId: row?.driverId, logData: { raceId: session?.eventId, driverId: row?.driverId } });
|
||||
}
|
||||
return changed;
|
||||
};
|
||||
const RACE_CALL_AUDIO = { attention: "driver_attention", official_warning: "official_warning", stop_and_go: "stop_and_go", drive_through: "drive_through" };
|
||||
const callRaceControl = (session, row, kind, options = {}) => {
|
||||
const entry = logRaceControlCall(session, row, kind, options, { ensureSessionResult, uid, t, saveState: saveCorrectionFor(session) });
|
||||
if (entry) triggerRaceAudio(RACE_CALL_AUDIO[kind], { force: true, interrupt: true, variables: { driverName: row?.displayName || row?.driverName || "" }, driverId: row?.driverId, logData: { raceId: session?.eventId, sessionId: session?.id, driverId: row?.driverId } });
|
||||
return entry;
|
||||
};
|
||||
const getJudgingSession = () => (judgingSessionId && state.sessions.find((session) => session.id === judgingSessionId)) || null;
|
||||
// The heats to judge: the live / active one first, then every run heat, newest first.
|
||||
const getJudgingSessionChoices = () => {
|
||||
const active = getActiveSession();
|
||||
const run = state.sessions
|
||||
.filter((session) => session.id !== active?.id && session.status !== "ready")
|
||||
.sort((a, b) => Number(b.startedAt || b.endedAt || 0) - Number(a.startedAt || a.endedAt || 0))
|
||||
.slice(0, 60);
|
||||
const label = (session) => `${["running", "paused"].includes(session.status) ? "● " : ""}${getEventName(session.eventId) || "-"} – ${session.name} (${getStatusLabel(session.status)})`;
|
||||
return [...(active ? [active] : []), ...run].map((session) => ({ id: session.id, label: label(session) }));
|
||||
};
|
||||
const hasFinalsFromQualifying = (session) => state.sessions.some((item) => item.eventId === session.eventId && item.type === "final");
|
||||
const getJudgeFilteredLog = (adjustments, filterValue) => getJudgeFilteredLogLogic(adjustments, filterValue);
|
||||
|
||||
const NAV_ITEMS = [
|
||||
@@ -2496,6 +2526,29 @@ const TRANSLATIONS = {
|
||||
"timing.invalid_long": "Över maxvarv",
|
||||
"timing.long_lap_stint": "Långt varv · räknat · ny stint",
|
||||
"judging.title": "Domarvy",
|
||||
"judging.session_pick": "Heat att döma",
|
||||
"judging.after_race_hint": "heatet är klart – straff och DSQ räknas om i resultat och ställning",
|
||||
"judging.finals_exist_hint": "Finalerna är redan skapade från kvalet. Ändras ordningen: skapa om finalerna under Hantera.",
|
||||
"judging.custom_sec": "Egen tid (s)",
|
||||
"judging.custom_sec_apply": "+ s straff",
|
||||
"judging.reason": "Orsak (loggas)",
|
||||
"judging.reason_placeholder": "T.ex. ojust omkörning, ej godkänd bil, tjuvstart",
|
||||
"judging.dsq": "DSQ – diskvalificera",
|
||||
"judging.dnf": "DNF",
|
||||
"judging.status_clear": "Ta bort DSQ/DNF",
|
||||
"judging.status_dsq": "Diskvalificerad (DSQ)",
|
||||
"judging.status_dnf": "Bröt (DNF)",
|
||||
"judging.status_cleared": "DSQ/DNF borttaget",
|
||||
"judging.dsq_confirm": "Diskvalificera {name} i det här heatet? Placeras sist (i kval: poäng som sista plats, enligt EFRA).",
|
||||
"judging.calls_title": "Utrop till föraren",
|
||||
"judging.calls_hint": "Speakern ropar upp föraren och det loggas. Ett stop & go räknas inte automatiskt – körs det inte: ge tidsstraff (EFRA: 10 s).",
|
||||
"judging.call_attention": "Observera (blå flagg)",
|
||||
"judging.call_official_warning": "Officiell varning",
|
||||
"judging.call_stop_and_go": "Stop & go",
|
||||
"judging.call_drive_through": "Drive through (extra depåstopp)",
|
||||
"judging.two_warnings_confirm": "{name} har nu två officiella varningar. Enligt EFRA blir föraren diskvalificerad från heatet. Diskvalificera?",
|
||||
"judging.two_warnings_reason": "Två officiella varningar",
|
||||
"judging.filter_log_calls": "Utrop",
|
||||
"judging.active_session": "Aktiv session",
|
||||
"judging.no_active_session": "Ingen aktiv session vald.",
|
||||
"judging.select_competitor": "Välj förare eller lag",
|
||||
@@ -2999,9 +3052,9 @@ const TRANSLATIONS = {
|
||||
"guide.validation_2": "Ogiltiga kortvarv under min-gränsen räknas inte alls i leaderboard eller statistik.",
|
||||
"guide.validation_3": "Ogiltiga långvarv över max-gränsen räknas inte som varv, men de kan bryta lap-basen så nästa giltiga varv börjar om korrekt.",
|
||||
"guide.validation_4": "När ordinarie tid är slut kan sessionen gå in i Follow-up aktiv om du har satt Follow-up tid i raceformat eller sessionen.",
|
||||
"guide.validation_5": "Straff (+1/-1 varv, +1/+5/-1 sekunder) finns bara i race (kval, heat, final) och görs av domaren i Domarvyn. Det slår igenom direkt i leaderboarden. Tidtagning -> Detaljer visar korrigeringarna och har knappen Öppna i Domarvyn.",
|
||||
"guide.validation_5": "Straff (+1/-1 varv, +1/+5/-1 s, egen tid t.ex. +10 s), DSQ och DNF finns i race (kval, heat, final) och ges i Domarvyn – även efter att heatet är klart (protest, ej godkänd bil): välj heatet under Heat att döma. Skriv en orsak, den loggas. DSQ placerar föraren sist; i kval ger det poäng som sista plats (EFRA). Resultat, ställning, race-översikt och arkiv räknas om direkt. Är finalerna redan skapade från kvalet varnar Domarvyn – skapa om dem om ordningen ändrats.",
|
||||
"guide.validation_6": "Under träning tar du bort, återställer eller godkänner valfritt varv direkt i Tidtagning -> Detaljer. Misstänkt korta varv (genvägar) flaggas med ⚠ och listas med Godkänn / Ta bort på Tidtagning och Race Day.",
|
||||
"guide.validation_7": "Domarvyn har leaderboard, varvhistorik med Ta bort / Återställ per varv, straff (endast race) och domarlogg med ångra för pågående session.",
|
||||
"guide.validation_7": "Under racet: Utrop till föraren – Observera (blå flagg), Officiell varning, Stop & go och Drive through (extra depåstopp). Speakern ropar upp föraren och det loggas med orsak. Två officiella varningar = DSQ från heatet (EFRA), Domarvyn frågar. Ett stop & go räknas inte automatiskt; körs det inte, ge tidsstraff (EFRA: 10 s). Domarvyn har också varvhistorik med Ta bort / Återställ per varv och domarlogg (filter Utrop) med ångra.",
|
||||
"guide.validation_8": "Domarvyn kan filtrera på ogiltiga rader, korrigerade rader eller teamrace, exportera domarloggen och ångra flera senaste manuella åtgärder via undo-knappar.",
|
||||
"guide.qualifying_title": "Seedning, poängtabeller och tie-break",
|
||||
"guide.qualifying_1": "Practice och kval kan nu använda tre seedmetoder: bästa N varv som summa, bästa N varv som snitt eller bästa N konsekutiva varv.",
|
||||
@@ -4592,6 +4645,29 @@ const TRANSLATIONS = {
|
||||
"timing.invalid_long": "Over max lap",
|
||||
"timing.long_lap_stint": "Long lap · counted · new stint",
|
||||
"judging.title": "Judging view",
|
||||
"judging.session_pick": "Heat to judge",
|
||||
"judging.after_race_hint": "the heat is finished – penalties and DSQ update the results and standings",
|
||||
"judging.finals_exist_hint": "The finals were already made from qualifying. If the order changes: make the finals again under Manage.",
|
||||
"judging.custom_sec": "Own time (s)",
|
||||
"judging.custom_sec_apply": "+ s penalty",
|
||||
"judging.reason": "Reason (logged)",
|
||||
"judging.reason_placeholder": "E.g. unfair overtake, car not legal, jump start",
|
||||
"judging.dsq": "DSQ – disqualify",
|
||||
"judging.dnf": "DNF",
|
||||
"judging.status_clear": "Remove DSQ/DNF",
|
||||
"judging.status_dsq": "Disqualified (DSQ)",
|
||||
"judging.status_dnf": "Did not finish (DNF)",
|
||||
"judging.status_cleared": "DSQ/DNF removed",
|
||||
"judging.dsq_confirm": "Disqualify {name} in this heat? Classified last (in qualifying: last-place points, as in EFRA).",
|
||||
"judging.calls_title": "Calls to the driver",
|
||||
"judging.calls_hint": "The speaker calls the driver and it is logged. A stop & go is not timed - if it is not served, give a time penalty (EFRA: 10 s).",
|
||||
"judging.call_attention": "Attention (blue flag)",
|
||||
"judging.call_official_warning": "Official warning",
|
||||
"judging.call_stop_and_go": "Stop & go",
|
||||
"judging.call_drive_through": "Drive through (extra pit stop)",
|
||||
"judging.two_warnings_confirm": "{name} now has two official warnings. Under EFRA the driver is disqualified from the heat. Disqualify?",
|
||||
"judging.two_warnings_reason": "Two official warnings",
|
||||
"judging.filter_log_calls": "Calls",
|
||||
"judging.active_session": "Active session",
|
||||
"judging.no_active_session": "No active session selected.",
|
||||
"judging.select_competitor": "Select driver or team",
|
||||
@@ -5095,9 +5171,9 @@ const TRANSLATIONS = {
|
||||
"guide.validation_2": "Invalid short laps under the minimum threshold do not count in the leaderboard or statistics.",
|
||||
"guide.validation_3": "Invalid long laps over the maximum threshold do not count as laps, but they can reset the lap base so the next valid lap starts correctly.",
|
||||
"guide.validation_4": "When the scheduled time ends, the session can enter Follow-up active if Follow-up time has been configured in race format or on the session.",
|
||||
"guide.validation_5": "Penalties (+1/-1 lap, +1/+5/-1 seconds) exist only in races (qualifying, heats, finals) and are given by the judge in the Judging view. The leaderboard updates immediately. Timing -> Details shows the corrections and has an Open in Judging button.",
|
||||
"guide.validation_5": "Penalties (+1/-1 lap, +1/+5/-1 s, own time e.g. +10 s), DSQ and DNF exist in races (qualifying, heats, finals) and are given in the Judging view - also after the heat is finished (a protest, a car not legal): pick the heat under Heat to judge. Write a reason; it is logged. DSQ classifies the driver last; in qualifying it scores last-place points (EFRA). Results, standings, race overview and archive update at once. If the finals were already made from qualifying, Judging warns - make them again if the order changed.",
|
||||
"guide.validation_6": "In practice, remove, restore or approve any lap right in Timing -> Details. Suspiciously short laps (shortcuts) are flagged with ⚠ and listed with Approve / Remove on Timing and Race Day.",
|
||||
"guide.validation_7": "The Judging view has the leaderboard, lap history with Remove / Restore per lap, penalties (races only) and the judging log with undo for the current session.",
|
||||
"guide.validation_7": "During the race: Calls to the driver - Attention (blue flag), Official warning, Stop & go and Drive through (extra pit stop). The speaker calls the driver and it is logged with the reason. Two official warnings = DSQ from the heat (EFRA); Judging asks. A stop & go is not timed; if it is not served, give a time penalty (EFRA: 10 s). Judging also has the lap history with Remove / Restore per lap and the judging log (filter Calls) with undo.",
|
||||
"guide.validation_8": "The Judging view can filter invalid rows, corrected rows or team race rows, export the judging log and undo multiple recent manual actions via undo buttons.",
|
||||
"guide.qualifying_title": "Seeding, points tables and tie-break",
|
||||
"guide.qualifying_1": "Practice and qualifying can now use three seed methods: best N laps as total, best N laps as average or best N consecutive laps.",
|
||||
@@ -5342,6 +5418,7 @@ let selectedEventEditId = null;
|
||||
let selectedSessionEditId = null;
|
||||
let selectedTeamEditId = null;
|
||||
let selectedJudgeKey = null;
|
||||
let judgingSessionId = "";
|
||||
let selectedTrainingDriverId = String(urlParams.get("driver") || "");
|
||||
let selectedTrainingClassId = String(urlParams.get("class") || "");
|
||||
let judgingCompetitorFilter = "all";
|
||||
|
||||
+68
-1
@@ -58,7 +58,8 @@ export function applyCompetitorCorrection(session, row, options = {}, { ensureSe
|
||||
competitorKey: row.key,
|
||||
displayName: row.displayName || row.driverName || t("common.unknown_driver"),
|
||||
action: t("timing.manual_corrections"),
|
||||
detail: detailBits.join(" • ") || "-",
|
||||
detail: [detailBits.join(" • "), String(options.reason || "").trim()].filter(Boolean).join(" – ") || "-",
|
||||
reason: String(options.reason || "").trim(),
|
||||
category: "correction",
|
||||
undo: {
|
||||
type: "restore_correction_state",
|
||||
@@ -212,6 +213,11 @@ export function undoJudgingAdjustment(session, adjustmentId, { ensureSessionResu
|
||||
// both and the newer one silently re-adding one back. See applyCompetitorCorrection.
|
||||
entry.manualLapAdjustment = (Number(entry.manualLapAdjustment || 0) || 0) - (Number(adjustment.undo.lapDelta || 0) || 0);
|
||||
entry.manualTimeAdjustmentMs = (Number(entry.manualTimeAdjustmentMs || 0) || 0) - (Number(adjustment.undo.timeMsDelta || 0) || 0);
|
||||
} else if (adjustment.undo.type === "set_race_status") {
|
||||
entry.raceStatus = adjustment.undo.raceStatus || "";
|
||||
if (!entry.raceStatus) delete entry.raceStatus;
|
||||
} else if (adjustment.undo.type === "race_call") {
|
||||
// A spoken call can't be taken back; undo only takes it out of the count (warnings).
|
||||
} else if (adjustment.undo.type === "set_passing_validity") {
|
||||
const passing = findPassingByUndoMarker(session, adjustment.competitorKey, adjustment.undo.passingTimestamp);
|
||||
if (!passing) {
|
||||
@@ -266,8 +272,69 @@ export function getJudgeFilteredLog(adjustments, filterValue) {
|
||||
if (filterValue === "invalid") {
|
||||
return adjustments.filter((entry) => entry.category === "invalid");
|
||||
}
|
||||
if (filterValue === "calls") {
|
||||
return adjustments.filter((entry) => entry.category === "call");
|
||||
}
|
||||
if (filterValue === "undo") {
|
||||
return adjustments.filter((entry) => entry.category === "undo");
|
||||
}
|
||||
return adjustments;
|
||||
}
|
||||
|
||||
|
||||
// DSQ / DNF for a driver in a heat, qualifier or final - also after it is finished (a protest,
|
||||
// a car found illegal). EFRA: a driver disqualified in a qualifying round scores points for
|
||||
// last place in it (as with no time); disqualified from a heat or final = classified last.
|
||||
// DNF keeps the laps (classified on laps as usual) and is shown as DNF. "" clears it.
|
||||
export function setCompetitorRaceStatus(session, row, status, { reason = "" } = {}, { ensureSessionResult, uid, t, saveState }) {
|
||||
const result = ensureSessionResult(session.id);
|
||||
const entry = result.competitors[row.key];
|
||||
if (!entry || !["dsq", "dnf", ""].includes(status)) return false;
|
||||
const previous = entry.raceStatus || "";
|
||||
if (previous === status) return false;
|
||||
if (status) entry.raceStatus = status; else delete entry.raceStatus;
|
||||
const cleanReason = String(reason || "").trim();
|
||||
result.adjustments.push({
|
||||
id: uid("judge"),
|
||||
ts: Date.now(),
|
||||
competitorKey: row.key,
|
||||
displayName: row.displayName || row.driverName || t("common.unknown_driver"),
|
||||
action: status ? t(`judging.status_${status}`) : t("judging.status_cleared"),
|
||||
detail: cleanReason || "-",
|
||||
reason: cleanReason,
|
||||
category: "correction",
|
||||
undo: { type: "set_race_status", raceStatus: previous },
|
||||
});
|
||||
saveState();
|
||||
return true;
|
||||
}
|
||||
|
||||
// A race-control call to one driver, logged with the reason: "attention" (blue flag),
|
||||
// "official_warning", "stop_and_go", "drive_through". The stop itself isn't timed - if it is
|
||||
// not served, the judge gives a time penalty (EFRA: 10 s when the driver can't be called in).
|
||||
export const RACE_CALLS = ["attention", "official_warning", "stop_and_go", "drive_through"];
|
||||
export function logRaceControlCall(session, row, kind, { reason = "" } = {}, { ensureSessionResult, uid, t, saveState }) {
|
||||
const result = ensureSessionResult(session.id);
|
||||
if (!result.competitors[row.key] || !RACE_CALLS.includes(kind)) return null;
|
||||
const cleanReason = String(reason || "").trim();
|
||||
const entry = {
|
||||
id: uid("judge"),
|
||||
ts: Date.now(),
|
||||
competitorKey: row.key,
|
||||
displayName: row.displayName || row.driverName || t("common.unknown_driver"),
|
||||
action: t(`judging.call_${kind}`),
|
||||
detail: cleanReason || "-",
|
||||
reason: cleanReason,
|
||||
callKind: kind,
|
||||
category: "call",
|
||||
undo: { type: "race_call" },
|
||||
};
|
||||
result.adjustments.push(entry);
|
||||
saveState();
|
||||
return entry;
|
||||
}
|
||||
|
||||
// Official warnings given to a driver in this session (undone ones don't count).
|
||||
export function countOfficialWarnings(result, competitorKey) {
|
||||
return (result?.adjustments || []).filter((entry) => entry.competitorKey === competitorKey && entry.callKind === "official_warning" && !entry.undoneAt).length;
|
||||
}
|
||||
@@ -38,6 +38,8 @@ export const RACE_AUDIO_EVENT_DEFINITIONS = Object.freeze([
|
||||
event("marshal_warning", "control", "high", true, "effects/warning.wav", 1000), event("marshal_required", "control", "high", true, "effects/warning.wav", 1000),
|
||||
event("penalty", "control", "high", true, "effects/warning.wav", 750), event("stop_and_go", "control", "high", true, "effects/warning.wav"),
|
||||
event("drive_through", "control", "high", true, "effects/warning.wav"), event("disqualified", "control", "high", true, "effects/warning.wav"),
|
||||
// EFRA 9.1-9.3: "Attention driver (name)" (blue flag) and an official warning (2 = DSQ).
|
||||
event("driver_attention", "control", "high", true, "effects/warning.wav", 750), event("official_warning", "control", "high", true, "effects/warning.wav"),
|
||||
event("pit_lane_open", "pit", "normal"), event("pit_lane_closed", "pit", "normal"),
|
||||
event("entering_pits", "pit", "low", false, "effects/transponder_pass.wav"), event("leaving_pits", "pit", "low", false, "effects/transponder_pass.wav"),
|
||||
event("pit_speed_warning", "pit", "high", true, "effects/warning.wav"),
|
||||
|
||||
@@ -4872,3 +4872,10 @@ details.event-group > summary { cursor: pointer; list-style: revert; }
|
||||
.manual-session-add > summary { font-weight: 600; padding: 4px 0; }
|
||||
.manual-session-add[open] > summary { margin-bottom: 12px; }
|
||||
.manage-branding > summary h3 { display: inline; }
|
||||
|
||||
/* Judging: heat picker, own penalty time, reason */
|
||||
.judging-session-pick { display: grid; gap: 4px; max-width: 520px; }
|
||||
.judge-custom-sec { display: inline-flex; gap: 6px; align-items: center; }
|
||||
.judge-custom-sec input { width: 80px; }
|
||||
.judge-reason { display: grid; gap: 4px; }
|
||||
.pill-red { background: var(--danger, #c0392b); color: #fff; }
|
||||
+22
-5
@@ -343,7 +343,21 @@ export function buildLeaderboard(session, { ensureSessionResult, getSessionTarge
|
||||
};
|
||||
});
|
||||
|
||||
// Judge's DSQ / DNF (judging_logic setCompetitorRaceStatus): DSQ always last, its time out of
|
||||
// every comparison; DNF is classified on its laps as usual and only labelled.
|
||||
rows.forEach((row) => {
|
||||
if (row.raceStatus === "dsq") {
|
||||
row.comparisonMs = Number.MAX_SAFE_INTEGER;
|
||||
row.seedMetric = null;
|
||||
row.practiceMetric = null;
|
||||
row.resultDisplay = "DSQ";
|
||||
} else if (row.raceStatus === "dnf") {
|
||||
row.resultDisplay = `DNF · ${row.resultDisplay}`;
|
||||
}
|
||||
});
|
||||
rows.sort((a, b) => {
|
||||
const aDsq = a.raceStatus === "dsq";
|
||||
if (aDsq !== (b.raceStatus === "dsq")) return aDsq ? 1 : -1;
|
||||
if (isRollingPractice) {
|
||||
if (a.comparisonMs !== b.comparisonMs) {
|
||||
return a.comparisonMs - b.comparisonMs;
|
||||
@@ -721,6 +735,8 @@ export function buildQualifyingStandings(event, { getSessionsForEvent, buildLead
|
||||
: rows;
|
||||
rowsWithDns.forEach((row, index) => {
|
||||
const key = row.driverId || row.key;
|
||||
// EFRA: a time disqualified in a round scores points for last place in that round.
|
||||
const place = row.raceStatus === "dsq" ? entrantCount : index + 1;
|
||||
if (!competitorMap.has(key)) {
|
||||
competitorMap.set(key, {
|
||||
key,
|
||||
@@ -733,10 +749,10 @@ export function buildQualifyingStandings(event, { getSessionsForEvent, buildLead
|
||||
});
|
||||
}
|
||||
const entry = competitorMap.get(key);
|
||||
entry.points.push(getQualifyingPointsValue(index + 1, entrantCount, pointsTable));
|
||||
entry.ranks.push(index + 1);
|
||||
entry.points.push(getQualifyingPointsValue(place, entrantCount, pointsTable));
|
||||
entry.ranks.push(place);
|
||||
entry.roundMetrics.push(row.comparisonMs);
|
||||
if (Number.isFinite(row.bestLapMs)) {
|
||||
if (Number.isFinite(row.bestLapMs) && row.raceStatus !== "dsq") {
|
||||
entry.bestLaps.push(row.bestLapMs);
|
||||
}
|
||||
if (!entry.bestRoundDisplay || row.comparisonMs < (entry.bestRoundMetricValue ?? Number.MAX_SAFE_INTEGER)) {
|
||||
@@ -1085,8 +1101,9 @@ export function buildFinalStandings(event, { getSessionsForEvent, buildLeaderboa
|
||||
});
|
||||
}
|
||||
const entry = competitorMap.get(key);
|
||||
entry.legRanks.push(index + 1);
|
||||
entry.bestElapsedMs.push(row.totalElapsedMs);
|
||||
// Disqualified from a final = classified last in it (behind those who did not start).
|
||||
entry.legRanks.push(row.raceStatus === "dsq" ? rowsWithDns.length + 1 : index + 1);
|
||||
entry.bestElapsedMs.push(row.raceStatus === "dsq" ? Number.MAX_SAFE_INTEGER : row.totalElapsedMs);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+74
-5
@@ -739,18 +739,28 @@ export function renderJudgingView(deps) {
|
||||
getJudgingCompetitorFilter, setJudgingCompetitorFilter, getJudgingLogFilter, setJudgingLogFilter,
|
||||
setCompetitorLapStatus = () => false,
|
||||
renderSpeakerPanel = () => "", bindSpeakerPanel = () => {},
|
||||
// The heat being judged: the active one, or one picked (also a finished one - protests).
|
||||
getJudgingSession = () => null, setJudgingSessionId = () => {}, getJudgingSessionChoices = () => [],
|
||||
setCompetitorRaceStatus = () => false, callRaceControl = () => null, countOfficialWarnings = () => 0,
|
||||
hasFinalsFromQualifying = () => false,
|
||||
} = deps;
|
||||
|
||||
const active = getActiveSession();
|
||||
const active = getJudgingSession() || getActiveSession();
|
||||
if (!active) {
|
||||
dom.view.innerHTML = `
|
||||
<section class="panel">
|
||||
<div class="panel-header"><h3>${t("judging.title")}</h3></div>
|
||||
<div class="panel-body"><p>${t("judging.no_active_session")}</p></div>
|
||||
<div class="panel-body"><p>${t("judging.no_active_session")}</p>
|
||||
${getJudgingSessionChoices().length ? `<label class="judging-session-pick"><span>${t("judging.session_pick")}</span><select id="judgingSessionSelect"><option value="">-</option>${getJudgingSessionChoices().map((choice) => `<option value="${escapeHtml(choice.id)}">${escapeHtml(choice.label)}</option>`).join("")}</select></label>` : ""}
|
||||
</div>
|
||||
</section>
|
||||
${renderSpeakerPanel()}
|
||||
`;
|
||||
bindSpeakerPanel(dom.view);
|
||||
document.getElementById("judgingSessionSelect")?.addEventListener("change", (changeEvent) => {
|
||||
setJudgingSessionId(changeEvent.currentTarget.value);
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -773,10 +783,14 @@ export function renderJudgingView(deps) {
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h3>${t("judging.title")}</h3>
|
||||
<span class="pill pill-green">${escapeHtml(active.name)}</span>
|
||||
<span class="pill ${["running", "paused"].includes(active.status) ? "pill-green" : ""}">${escapeHtml(active.name)}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>${t("judging.active_session")}: <strong>${escapeHtml(active.name)}</strong> • ${escapeHtml(getSessionTypeLabel(active.type))}</p>
|
||||
<label class="judging-session-pick"><span>${t("judging.session_pick")}</span>
|
||||
<select id="judgingSessionSelect">${getJudgingSessionChoices().map((choice) => `<option value="${escapeHtml(choice.id)}" ${choice.id === active.id ? "selected" : ""}>${escapeHtml(choice.label)}</option>`).join("")}</select>
|
||||
</label>
|
||||
<p>${escapeHtml(getSessionTypeLabel(active.type))}${["finished", "stopped"].includes(active.status) ? ` • ${t("judging.after_race_hint")}` : ""}</p>
|
||||
${active.type === "qualification" && hasFinalsFromQualifying(active) ? `<p class="form-error">${t("judging.finals_exist_hint")}</p>` : ""}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -828,11 +842,29 @@ export function renderJudgingView(deps) {
|
||||
<button class="btn" id="judgeLapMinus">${t("timing.penalty_remove_lap")}</button>
|
||||
<button class="btn" id="judgeSecPlus">${t("timing.penalty_add_sec")}</button>
|
||||
<button class="btn" id="judgeFivePlus">${t("timing.penalty_add_5sec")}</button>
|
||||
<button class="btn" id="judgeSecMinus">${t("timing.penalty_remove_sec")}</button>`}
|
||||
<button class="btn" id="judgeSecMinus">${t("timing.penalty_remove_sec")}</button>
|
||||
<span class="judge-custom-sec"><input type="number" id="judgeCustomSec" min="1" max="600" step="1" value="10" aria-label="${escapeHtml(t("judging.custom_sec"))}" /><button class="btn" id="judgeCustomApply" type="button">${t("judging.custom_sec_apply")}</button></span>`}
|
||||
<button class="btn" id="judgeInvalidate">${t("timing.invalidate_last_lap")}</button>
|
||||
<button class="btn" id="judgeRestore">${t("timing.restore_last_invalid")}</button>
|
||||
${isPracticeType(active.type) ? "" : `<button class="btn btn-danger" id="judgeReset">${t("timing.penalty_reset")}</button>`}
|
||||
</div>
|
||||
${isPracticeType(active.type) ? "" : `
|
||||
<label class="mt-8 judge-reason"><span>${t("judging.reason")}</span><input id="judgeReason" type="text" maxlength="120" placeholder="${escapeHtml(t("judging.reason_placeholder"))}" /></label>
|
||||
<div class="actions mt-8">
|
||||
${selectedRow.raceStatus === "dsq" ? `<span class="pill pill-red">DSQ</span>` : selectedRow.raceStatus === "dnf" ? `<span class="pill">DNF</span>` : ""}
|
||||
${selectedRow.raceStatus !== "dsq" ? `<button class="btn btn-danger" id="judgeDsq" type="button">${t("judging.dsq")}</button>` : ""}
|
||||
${selectedRow.raceStatus !== "dnf" ? `<button class="btn" id="judgeDnf" type="button">${t("judging.dnf")}</button>` : ""}
|
||||
${selectedRow.raceStatus ? `<button class="btn" id="judgeStatusClear" type="button">${t("judging.status_clear")}</button>` : ""}
|
||||
</div>
|
||||
${["running", "paused"].includes(active.status) ? `
|
||||
<h4 class="mt-16">${t("judging.calls_title")}</h4>
|
||||
<p class="hint">${t("judging.calls_hint")}</p>
|
||||
<div class="actions">
|
||||
<button class="btn" type="button" data-judge-call="attention">${t("judging.call_attention")}</button>
|
||||
<button class="btn" type="button" data-judge-call="official_warning">${t("judging.call_official_warning")} (${countOfficialWarnings(result, selectedRow.key)})</button>
|
||||
<button class="btn btn-danger" type="button" data-judge-call="stop_and_go">${t("judging.call_stop_and_go")}</button>
|
||||
<button class="btn btn-danger" type="button" data-judge-call="drive_through">${t("judging.call_drive_through")}</button>
|
||||
</div>` : ""}`}
|
||||
<div class="mt-16">
|
||||
<h4>${t("timing.lap_history")}</h4>
|
||||
${
|
||||
@@ -868,6 +900,7 @@ export function renderJudgingView(deps) {
|
||||
<option value="all" ${getJudgingLogFilter() === "all" ? "selected" : ""}>${t("judging.filter_all")}</option>
|
||||
<option value="corrections" ${getJudgingLogFilter() === "corrections" ? "selected" : ""}>${t("judging.filter_log_corrections")}</option>
|
||||
<option value="invalid" ${getJudgingLogFilter() === "invalid" ? "selected" : ""}>${t("judging.filter_log_invalidations")}</option>
|
||||
<option value="calls" ${getJudgingLogFilter() === "calls" ? "selected" : ""}>${t("judging.filter_log_calls")}</option>
|
||||
<option value="undo" ${getJudgingLogFilter() === "undo" ? "selected" : ""}>${t("judging.filter_log_undo")}</option>
|
||||
</select>
|
||||
<button class="btn" id="judgingExportLog" type="button">${t("judging.export_log")}</button>
|
||||
@@ -960,9 +993,45 @@ export function renderJudgingView(deps) {
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById("judgingSessionSelect")?.addEventListener("change", (changeEvent) => {
|
||||
setJudgingSessionId(changeEvent.currentTarget.value);
|
||||
setSelectedJudgeKey(null);
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
|
||||
if (!selectedRow) {
|
||||
return;
|
||||
}
|
||||
const reason = () => String(document.getElementById("judgeReason")?.value || "").trim();
|
||||
document.getElementById("judgeCustomApply")?.addEventListener("click", () => {
|
||||
const seconds = Math.round(Number(document.getElementById("judgeCustomSec")?.value || 0));
|
||||
if (!(seconds > 0)) return;
|
||||
applyCompetitorCorrection(active, selectedRow, { timeMsDelta: seconds * 1000, reason: reason() });
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
document.getElementById("judgeDsq")?.addEventListener("click", () => {
|
||||
if (!window.confirm(t("judging.dsq_confirm", { name: selectedRow.displayName || selectedRow.driverName || "" }))) return;
|
||||
setCompetitorRaceStatus(active, selectedRow, "dsq", { reason: reason() });
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
document.getElementById("judgeDnf")?.addEventListener("click", () => {
|
||||
setCompetitorRaceStatus(active, selectedRow, "dnf", { reason: reason() });
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
document.getElementById("judgeStatusClear")?.addEventListener("click", () => {
|
||||
setCompetitorRaceStatus(active, selectedRow, "", { reason: reason() });
|
||||
renderJudgingView(deps);
|
||||
});
|
||||
document.querySelectorAll("[data-judge-call]").forEach((button) => button.addEventListener("click", () => {
|
||||
const kind = button.dataset.judgeCall;
|
||||
callRaceControl(active, selectedRow, kind, { reason: reason() });
|
||||
// EFRA 9.3: two official warnings - disqualified from the race in progress.
|
||||
if (kind === "official_warning" && countOfficialWarnings(ensureSessionResult(active.id), selectedRow.key) >= 2
|
||||
&& window.confirm(t("judging.two_warnings_confirm", { name: selectedRow.displayName || selectedRow.driverName || "" }))) {
|
||||
setCompetitorRaceStatus(active, selectedRow, "dsq", { reason: t("judging.two_warnings_reason") });
|
||||
}
|
||||
renderJudgingView(deps);
|
||||
}));
|
||||
|
||||
document.getElementById("judgeLapPlus")?.addEventListener("click", () => {
|
||||
applyCompetitorCorrection(active, selectedRow, { lapDelta: 1 });
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
// Judging after the race: a finished qualifier can be picked under Judging (a protest, a car
|
||||
// found illegal) - a time penalty with a reason and a DSQ change the result straight away.
|
||||
export async function runJudgingAfterRaceSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs }) {
|
||||
const dialogsAtStart = dialogs.length;
|
||||
const patchState = async (patch) => {
|
||||
const current = await savedState();
|
||||
Object.assign(current, patch);
|
||||
const response = await fetch(base + "/api/state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(current) });
|
||||
assert.equal(response.ok, true);
|
||||
};
|
||||
const seeded = await savedState();
|
||||
const startedAt = Date.now() - 900000;
|
||||
const event = { id: "ja_event", name: "JA Cup", mode: "race", raceConfig: {} };
|
||||
const heat = { id: "ja_q1", eventId: event.id, name: "Q1 H1", type: "qualification", mode: "race", status: "finished", durationMin: 5, startedAt, endedAt: startedAt + 300000 };
|
||||
const competitor = (id, laps, lastTs) => ({ key: id, driverId: id, driverName: id, displayName: id, transponder: id, laps, bestLapMs: 18000, lastLapMs: 18000, startTimestamp: startedAt, lastTimestamp: lastTs });
|
||||
await patchState({
|
||||
drivers: [...seeded.drivers, { id: "JA Winner", name: "JA Winner", transponder: "8550001" }, { id: "JA Second", name: "JA Second", transponder: "8550002" }],
|
||||
events: [...seeded.events, event],
|
||||
sessions: [...seeded.sessions.map((session) => (["running", "paused"].includes(session.status) ? { ...session, status: "finished", endedAt: Date.now() } : session)), heat],
|
||||
resultsBySession: { ...seeded.resultsBySession, [heat.id]: { passings: [], adjustments: [], competitors: { "JA Winner": competitor("JA Winner", 17, startedAt + 300000), "JA Second": competitor("JA Second", 16, startedAt + 301000) } } },
|
||||
activeSessionId: null,
|
||||
});
|
||||
const competitors = async () => (await savedState()).resultsBySession.ja_q1.competitors;
|
||||
|
||||
await navigate("judging", "speakerPanel");
|
||||
await waitFor(async () => evaluate(`Boolean(document.querySelector('#judgingSessionSelect option[value="ja_q1"]'))`), "the finished heat can be picked");
|
||||
await evaluate(`(() => { const select = document.getElementById("judgingSessionSelect"); select.value = "ja_q1"; select.dispatchEvent(new Event("change")); })()`);
|
||||
await waitFor(async () => evaluate(`Boolean(document.getElementById("judgeDsq"))`), "the winner is selected with the penalty buttons");
|
||||
assert.match(await evaluate(`document.querySelector(".judge-selected-row")?.textContent || ""`), /JA Winner/);
|
||||
assert.equal(await evaluate(`Boolean(document.querySelector("[data-judge-call]"))`), false, "no calls to the driver after the race");
|
||||
|
||||
await evaluate(`(() => { document.getElementById("judgeReason").value = "Unfair overtake"; document.getElementById("judgeCustomSec").value = "10"; document.getElementById("judgeCustomApply").click(); })()`);
|
||||
await waitFor(async () => (await competitors())["JA Winner"].manualTimeAdjustmentMs === 10000, "+10 s saved");
|
||||
assert.ok((await savedState()).resultsBySession.ja_q1.adjustments.some((entry) => entry.reason === "Unfair overtake"), "the reason is logged");
|
||||
|
||||
await evaluate(`document.getElementById("judgeDsq").click()`);
|
||||
await waitFor(async () => (await competitors())["JA Winner"].raceStatus === "dsq", "DSQ saved");
|
||||
await waitFor(async () => /JA Second/.test(await evaluate(`document.querySelector("#judgingCompetitorFilter")?.closest(".panel")?.querySelector("tbody tr")?.textContent || ""`)), "the disqualified winner drops to last");
|
||||
assert.ok(dialogs.slice(dialogsAtStart).some((dialog) => dialog.type === "confirm" && /JA Winner/.test(dialog.message)), "DSQ asks first");
|
||||
dialogs.splice(dialogsAtStart);
|
||||
console.log("PASS judging after the race: pick a finished heat, +10 s with a reason, DSQ puts the driver last");
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { runTrackLayoutsSmoke } from "./browser_track_layouts.js";
|
||||
import { runPrologueSmoke } from "./browser_prologue.js";
|
||||
import { runPracticeResetSmoke } from "./browser_practice_reset.js";
|
||||
import { runPracticeRankingSmoke, runSpeakerPanelSmoke } from "./browser_practice_ranking.js";
|
||||
import { runJudgingAfterRaceSmoke } from "./browser_judging_after.js";
|
||||
import { runSuspectLapsSmoke } from "./browser_suspect_laps.js";
|
||||
import { runOverlayDriverLinkSmoke } from "./browser_overlay_driver_link.js";
|
||||
import { runProfileClassSmoke } from "./browser_profile_class.js";
|
||||
@@ -169,6 +170,7 @@ try {
|
||||
await runPracticeResetSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runPracticeRankingSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runSpeakerPanelSmoke({ evaluate, navigate, savedState, waitFor });
|
||||
await runJudgingAfterRaceSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runSuspectLapsSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runOverlayDriverLinkSmoke({ evaluate, navigate, savedState, waitFor, base, send });
|
||||
await runDecoderClockSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { applyCompetitorCorrection, setCompetitorRaceStatus, logRaceControlCall, countOfficialWarnings, undoJudgingAdjustment, getJudgeFilteredLog } from "../src/judging_logic.js";
|
||||
import { buildQualifyingStandings, buildFinalStandings, getQualifyingPointsValue, isHighPointsTable, compareNumberSet, hasQualifyingPrimaryTie, buildQualifyingTieBreakNote } from "../src/timing_logic.js";
|
||||
|
||||
function harness() {
|
||||
const result = { passings: [], competitors: { d1: { key: "d1", driverName: "One" }, d2: { key: "d2", driverName: "Two" } }, adjustments: [] };
|
||||
let id = 0;
|
||||
const deps = { ensureSessionResult: () => result, uid: (p) => `${p}_${++id}`, t: (key) => key, formatLap: (ms) => `${ms}ms`, saveState: () => {}, findPassingByUndoMarker: () => null, recalculateCompetitorFromPassings: () => {} };
|
||||
return { result, deps, session: { id: "s1", status: "finished" } };
|
||||
}
|
||||
|
||||
test("a time penalty after the race keeps its reason in the log", () => {
|
||||
const { result, deps, session } = harness();
|
||||
applyCompetitorCorrection(session, result.competitors.d1, { timeMsDelta: 10000, reason: "Unfair overtake" }, deps);
|
||||
assert.equal(result.competitors.d1.manualTimeAdjustmentMs, 10000);
|
||||
assert.match(result.adjustments[0].detail, /Unfair overtake/);
|
||||
assert.equal(result.adjustments[0].reason, "Unfair overtake");
|
||||
});
|
||||
|
||||
test("DSQ / DNF are set, logged with the reason, and undone back to what was there", () => {
|
||||
const { result, deps, session } = harness();
|
||||
assert.equal(setCompetitorRaceStatus(session, result.competitors.d1, "dnf", {}, deps), true);
|
||||
assert.equal(setCompetitorRaceStatus(session, result.competitors.d1, "dsq", { reason: "Car not legal" }, deps), true);
|
||||
assert.equal(result.competitors.d1.raceStatus, "dsq");
|
||||
assert.equal(result.adjustments[1].detail, "Car not legal");
|
||||
assert.equal(setCompetitorRaceStatus(session, result.competitors.d1, "dsq", {}, deps), false, "no change, nothing logged");
|
||||
assert.equal(undoJudgingAdjustment(session, result.adjustments[1].id, deps), true);
|
||||
assert.equal(result.competitors.d1.raceStatus, "dnf");
|
||||
assert.equal(undoJudgingAdjustment(session, result.adjustments[0].id, deps), true);
|
||||
assert.equal(result.competitors.d1.raceStatus, undefined);
|
||||
});
|
||||
|
||||
test("race-control calls are logged; official warnings are counted, undone ones not", () => {
|
||||
const { result, deps, session } = harness();
|
||||
logRaceControlCall(session, result.competitors.d2, "stop_and_go", { reason: "Hit a car" }, deps);
|
||||
const first = logRaceControlCall(session, result.competitors.d2, "official_warning", {}, deps);
|
||||
logRaceControlCall(session, result.competitors.d2, "official_warning", {}, deps);
|
||||
assert.equal(logRaceControlCall(session, result.competitors.d2, "nonsense", {}, deps), null);
|
||||
assert.equal(countOfficialWarnings(result, "d2"), 2);
|
||||
undoJudgingAdjustment(session, first.id, deps);
|
||||
assert.equal(countOfficialWarnings(result, "d2"), 1);
|
||||
assert.equal(getJudgeFilteredLog(result.adjustments, "calls").length, 3);
|
||||
});
|
||||
|
||||
const qualDeps = (rowsBySession, entrants) => ({
|
||||
getSessionsForEvent: () => Object.keys(rowsBySession).map((id) => ({ id, type: "qualification", name: id, status: "finished" })),
|
||||
buildLeaderboard: (session) => rowsBySession[session.id],
|
||||
getSessionEntrants: () => entrants,
|
||||
isHighPointsTable, getQualifyingPointsValue, compareNumberSet, hasQualifyingPrimaryTie,
|
||||
buildQualifyingTieBreakNote: (row, tieBreak) => buildQualifyingTieBreakNote(row, tieBreak, { t: (key) => key, formatLap: (ms) => `${ms}` }),
|
||||
formatLap: (ms) => `${ms}`, formatRaceClock: (ms) => `${ms}`, t: (key) => key,
|
||||
});
|
||||
|
||||
test("EFRA: a DSQ in a qualifying round scores last-place points there, its laps don't count", () => {
|
||||
const entrants = [{ id: "d1", name: "One" }, { id: "d2", name: "Two" }, { id: "d3", name: "Three" }];
|
||||
const rows = {
|
||||
q1: [
|
||||
{ driverId: "d2", driverName: "Two", comparisonMs: 15000, bestLapMs: 15000, resultDisplay: "a" },
|
||||
{ driverId: "d3", driverName: "Three", comparisonMs: 16000, bestLapMs: 16000, resultDisplay: "b" },
|
||||
{ driverId: "d1", driverName: "One", comparisonMs: Number.MAX_SAFE_INTEGER, bestLapMs: 14000, resultDisplay: "DSQ", raceStatus: "dsq" },
|
||||
],
|
||||
};
|
||||
const standings = buildQualifyingStandings({ id: "e", raceConfig: { qualifyingPointsTable: "rank_low" } }, qualDeps(rows, entrants));
|
||||
assert.deepEqual(standings.map((row) => row.driverId), ["d2", "d3", "d1"]);
|
||||
assert.equal(standings[2].bestSingleLapMs, Number.MAX_SAFE_INTEGER, "the disqualified run's fastest lap doesn't count");
|
||||
});
|
||||
|
||||
test("a DSQ in a final is classified last in it, behind a driver who did not start", () => {
|
||||
const sessions = [{ id: "a", type: "final", name: "A Final", status: "finished" }];
|
||||
const rows = [
|
||||
{ driverId: "d1", driverName: "One", totalElapsedMs: 300000, raceStatus: "dsq" },
|
||||
{ driverId: "d2", driverName: "Two", totalElapsedMs: 301000 },
|
||||
];
|
||||
const standings = buildFinalStandings({ id: "e", raceConfig: {} }, {
|
||||
getSessionsForEvent: () => sessions, buildLeaderboard: () => rows,
|
||||
getSessionEntrants: () => [{ id: "d1", name: "One" }, { id: "d2", name: "Two" }, { id: "d3", name: "Three" }], t: (key) => key,
|
||||
});
|
||||
assert.deepEqual(standings.map((row) => row.driverId), ["d2", "d3", "d1"]);
|
||||
});
|
||||
@@ -195,7 +195,7 @@ test("event catalog covers every supported race-audio event", () => {
|
||||
[
|
||||
"grid_open", "grid_closed", "race_1_minute", "race_30_seconds", "race_10_seconds", "drivers_ready", "start_sequence", "start_tone", "false_start", "restart_race", "staggered_release", "prologue_start", "prologue_minutes", "prologue_grid", "prologue_count", "prologue_hold", "prologue_resumed", "prologue_cancelled", "clock_running",
|
||||
"transponder_pass", "lap_completed", "personal_best", "fastest_lap", "track_record", "training_stable_pace", "new_leader", "position_gain", "position_loss", "final_lap", "one_minute_remaining", "thirty_seconds_remaining", "ten_seconds_remaining", "time_expired", "race_finished",
|
||||
"track_call", "track_clear", "yellow_flag", "red_flag", "race_paused", "race_resumed", "marshal_warning", "marshal_required", "penalty", "stop_and_go", "drive_through", "disqualified",
|
||||
"track_call", "track_clear", "yellow_flag", "red_flag", "race_paused", "race_resumed", "marshal_warning", "marshal_required", "penalty", "stop_and_go", "drive_through", "disqualified", "driver_attention", "official_warning",
|
||||
"pit_lane_open", "pit_lane_closed", "entering_pits", "leaving_pits", "pit_speed_warning",
|
||||
"qualifying_start", "qualifying_remaining", "qualifying_finished", "provisional_pole", "pole_position",
|
||||
"race_winner", "second_place", "third_place", "podium", "heat_winner", "overall_winner",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "./auth.test.js";
|
||||
import "./judging_penalties.test.js";
|
||||
import "./practice_rank.test.js";
|
||||
import "./team_race_logic.test.js";
|
||||
import "./race_overview.test.js";
|
||||
|
||||
Reference in new issue
Block a user