feat(race-day): live race for the race controller with order, laps, gaps and estimated finish (1.47.0)
This commit is contained in:
1 parent
c4163441fc
commit
54487a18a6
12 files changed
+169
-7
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.
|
No changes recorded yet.
|
||||||
|
|
||||||
|
## 1.47.0 - 2026-11-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Race Day shows the race live for the race controller, right under the clock while a heat, qualifier or final runs: the running order, laps, last lap, best lap, gap to the car ahead and to the leader, and the estimated finish (laps and time when the time is up). The heat's fastest lap is purple, a personal best on the last lap green, and a bar shows how far into the lap each car is. After the heat it shows the result. No other view is needed during a race.
|
||||||
|
|
||||||
## 1.46.1 - 2026-11-01
|
## 1.46.1 - 2026-11-01
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create
|
|||||||
**Race Day** is the operator's page; everything that *runs* a session happens here, while Timing is for *following*:
|
**Race Day** is the operator's page; everything that *runs* a session happens here, while Timing is for *following*:
|
||||||
- **Quick actions** at the top: **Start practice** (continue or start an Open Practice), **New track layout** (during practice) and **Create race**. The Dashboard has the same three common tasks.
|
- **Quick actions** at the top: **Start practice** (continue or start an Open Practice), **New track layout** (during practice) and **Create race**. The Dashboard has the same three common tasks.
|
||||||
- **A session picker** and the buttons that apply right now: Start, Pause, Resume, Finish, **↻ Run again** for a stopped or finished heat, qualifier or final (laps, results and clock reset), and for practice **Reset – new practice day**. Practice uses plain words and has no start lights. The picker lists today's races grouped per race (plus anything running); older races and other days' rounds are under **Show all sessions**.
|
- **A session picker** and the buttons that apply right now: Start, Pause, Resume, Finish, **↻ Run again** for a stopped or finished heat, qualifier or final (laps, results and clock reset), and for practice **Reset – new practice day**. Practice uses plain words and has no start lights. The picker lists today's races grouped per race (plus anything running); older races and other days' rounds are under **Show all sessions**.
|
||||||
|
- **Live race** for the race controller, right under the clock while a heat, qualifier or final runs: the running order with laps, last lap, best lap, gap to the car ahead and to the leader, and the estimated finish (laps and time when the time is up). The heat's fastest lap is purple, a personal best on the last lap green, and a bar shows how far into the lap each car is (red = late). After the heat it shows the result.
|
||||||
- The **heat queue** shows the current, next and after-next heat in running order: practice, qualifying round by round (Q1 H1, Q1 H2, Q2 H1 …), then finals from the lowest (C, B, A). When a heat is done, **▶ Next** selects the next one in one click.
|
- The **heat queue** shows the current, next and after-next heat in running order: practice, qualifying round by round (Q1 H1, Q1 H2, Q2 H1 …), then finals from the lowest (C, B, A). When a heat is done, **▶ Next** selects the next one in one click.
|
||||||
- **Preflight** checks the decoder, participants, transponders (missing or duplicated), the lap window, the grid and audio. Blockers come first, each with a shortcut to the right setting. The min/max lap time can be edited right there.
|
- **Preflight** checks the decoder, participants, transponders (missing or duplicated), the lap window, the grid and audio. Blockers come first, each with a shortcut to the right setting. The min/max lap time can be edited right there.
|
||||||
- **An automatic SQLite backup** is taken before every start.
|
- **An automatic SQLite backup** is taken before every start.
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ Gränssnittet finns på svenska och engelska.
|
|||||||
**Race Day** är operatörens sida; allt som *kör* en session görs här, medan Tidtagning är till för att *följa*:
|
**Race Day** är operatörens sida; allt som *kör* en session görs här, medan Tidtagning är till för att *följa*:
|
||||||
- **Snabbval** överst: **Starta träning** (fortsätt eller starta en Open Practice), **Ny banlayout** (under träning) och **Skapa race**. Översikten har samma tre vanliga uppgifter.
|
- **Snabbval** överst: **Starta träning** (fortsätt eller starta en Open Practice), **Ny banlayout** (under träning) och **Skapa race**. Översikten har samma tre vanliga uppgifter.
|
||||||
- **En sessionsväljare** och de knappar som gäller just nu: Start, Pausa, Fortsätt, Avsluta, **↻ Kör om** för ett avbrutet eller klart heat, kval eller final (varv, resultat och klocka nollställs), och för träning **Nollställ – ny träningsdag**. Träning använder vanliga ord och har inga startljus. Väljaren visar dagens race grupperade per race (plus det som pågår); äldre race och andra dagars deltävlingar finns under **Visa alla sessioner**.
|
- **En sessionsväljare** och de knappar som gäller just nu: Start, Pausa, Fortsätt, Avsluta, **↻ Kör om** för ett avbrutet eller klart heat, kval eller final (varv, resultat och klocka nollställs), och för träning **Nollställ – ny träningsdag**. Träning använder vanliga ord och har inga startljus. Väljaren visar dagens race grupperade per race (plus det som pågår); äldre race och andra dagars deltävlingar finns under **Visa alla sessioner**.
|
||||||
|
- **Live-race** för race controllern, direkt under klockan medan ett heat, kval eller final pågår: ordningen med varv, senaste varv, bästa varv, avstånd till bilen före och till ledaren, och beräknat slut (varv och tid när tiden går ut). Heatets snabbaste varv är lila, personbästa på senaste varvet grönt, och en stapel visar hur långt in på varvet varje bil är (röd = sen). Efter heatet visas resultatet.
|
||||||
- **Heat-kön** visar aktuellt, nästa och därpå följande heat i körordning: träning, kval omgång för omgång (Q1 H1, Q1 H2, Q2 H1 …), sedan finaler från lägsta (C, B, A). När ett heat är klart väljer **▶ Nästa** nästa heat med ett klick.
|
- **Heat-kön** visar aktuellt, nästa och därpå följande heat i körordning: träning, kval omgång för omgång (Q1 H1, Q1 H2, Q2 H1 …), sedan finaler från lägsta (C, B, A). När ett heat är klart väljer **▶ Nästa** nästa heat med ett klick.
|
||||||
- **Förkontrollen** kontrollerar decoder, deltagare, transpondrar (saknade eller dubbletter), varvtidsgränser, grid och ljud. Blockerare visas först, var och en med en genväg till rätt inställning. Min/max-varvtid kan ändras direkt där.
|
- **Förkontrollen** kontrollerar decoder, deltagare, transpondrar (saknade eller dubbletter), varvtidsgränser, grid och ljud. Blockerare visas först, var och en med en genväg till rätt inställning. Min/max-varvtid kan ändras direkt där.
|
||||||
- **En automatisk SQLite-backup** tas före varje start.
|
- **En automatisk SQLite-backup** tas före varje start.
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.46.1",
|
"version": "1.47.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.46.1",
|
"version": "1.47.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^12.11.1",
|
"better-sqlite3": "^12.11.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rc-racecore",
|
"name": "rc-racecore",
|
||||||
"version": "1.46.1",
|
"version": "1.47.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+33
-3
@@ -7,7 +7,7 @@ import { renderSettings, openSettingsTab } from "./settings.js";
|
|||||||
import { buildRaceDayQueue, buildRaceDayPreflight, getRaceDriverIds } from "./race_day_logic.js";
|
import { buildRaceDayQueue, buildRaceDayPreflight, getRaceDriverIds } from "./race_day_logic.js";
|
||||||
import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologueRemainingMs, holdPrologue, resumePrologue, setPrologueRemaining, takeDuePrologueCall, formatPrologueTime, getPrologueHandoverMs, normalizePrologueSec } from "./prologue_logic.js";
|
import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologueRemainingMs, holdPrologue, resumePrologue, setPrologueRemaining, takeDuePrologueCall, formatPrologueTime, getPrologueHandoverMs, normalizePrologueSec } from "./prologue_logic.js";
|
||||||
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
|
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
|
||||||
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay } from "./race_day_view.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 { 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 } from "./series_logic.js";
|
||||||
import { renderSeriesView } from "./series_view.js";
|
import { renderSeriesView } from "./series_view.js";
|
||||||
@@ -498,6 +498,7 @@ const renderRaceDay = () => renderRaceDayView({
|
|||||||
resetSessionData, startPracticeNow, findOpenPracticeToContinue,
|
resetSessionData, startPracticeNow, findOpenPracticeToContinue,
|
||||||
getLiveSession,
|
getLiveSession,
|
||||||
renderSuspectLapsPanel: (session) => renderSuspectLapsPanelWithRelease(session),
|
renderSuspectLapsPanel: (session) => renderSuspectLapsPanelWithRelease(session),
|
||||||
|
buildLeaderboard, getSessionTargetMs, formatRaceClock,
|
||||||
setCompetitorLapStatus,
|
setCompetitorLapStatus,
|
||||||
addTrackLayout, renderView, state, dom, t, escapeHtml, formatLap, formatCountdown, formatElapsedClock,
|
addTrackLayout, renderView, state, dom, t, escapeHtml, formatLap, formatCountdown, formatElapsedClock,
|
||||||
getEventName, getSessionTypeLabel, getStatusLabel, getStartModeLabel,
|
getEventName, getSessionTypeLabel, getStatusLabel, getStartModeLabel,
|
||||||
@@ -554,6 +555,7 @@ const refreshTimingDynamics = () => {
|
|||||||
document.querySelectorAll("[data-timing-clock], [data-race-day-clock]").forEach((node) => {
|
document.querySelectorAll("[data-timing-clock], [data-race-day-clock]").forEach((node) => {
|
||||||
node.textContent = clock;
|
node.textContent = clock;
|
||||||
});
|
});
|
||||||
|
if (currentView === "race_day") refreshRaceDayLive();
|
||||||
};
|
};
|
||||||
const renderTiming = () => renderTimingView({ renderSuspectLapsPanel: (session) => renderSuspectLapsPanelWithRelease(session), state, dom, t, escapeHtml, formatLap, formatCountdown, formatElapsedClock, formatRaceClock, renderTable, uid, getActiveSession, ensureSessionResult, buildLeaderboard, getSessionTiming, getVisiblePassings, getEventName, getSessionTypeLabel, getStatusLabel, normalizeStartMode, getStartModeLabel, renderPositionGrid, renderSessionChannelAnalysis, connectDecoder, disconnectDecoder, applyCompetitorCorrection, invalidateCompetitorLastLap, restoreCompetitorLastInvalidLap, startOperationalSession, finishOperationalSession, cancelRaceStart, triggerRaceAudio, getStartLightState: () => raceAudioEngine.getStartLightState(), saveState, updateHeaderState, renderView, normalizeDriver, normalizeCar, processDecoderMessage, getSelectedLeaderboardKey: () => selectedLeaderboardKey, setSelectedLeaderboardKey: (value) => { selectedLeaderboardKey = value; }, getQuickAddDraft: () => quickAddDraft, setQuickAddDraft: (value) => { quickAddDraft = value; }, getPassingValidationLabel, isCountedPassing, getCompetitorPassings, getManualCorrectionSummary, formatTeamActiveMemberLabel, lastFinishAnnouncementSessionId: () => lastFinishAnnouncementSessionId, setLastFinishAnnouncementSessionId: (value) => { lastFinishAnnouncementSessionId = value; }, lastOverlayLeaderKeyBySession, lastOverlayTop3BySession, overlayEvents: () => overlayEvents, setOverlayEvents: (value) => { overlayEvents = value; }, sessionReplay, syncTrainingLedger, setCompetitorLapStatus, getLiveSession, selectLiveSession: (id) => selectOperationalSession(id), openRaceDay: () => navigateToView("race_day"), openJudging: (rowKey) => { selectedJudgeKey = rowKey; selectedLeaderboardKey = null; navigateToView("judging"); } });
|
const renderTiming = () => renderTimingView({ renderSuspectLapsPanel: (session) => renderSuspectLapsPanelWithRelease(session), state, dom, t, escapeHtml, formatLap, formatCountdown, formatElapsedClock, formatRaceClock, renderTable, uid, getActiveSession, ensureSessionResult, buildLeaderboard, getSessionTiming, getVisiblePassings, getEventName, getSessionTypeLabel, getStatusLabel, normalizeStartMode, getStartModeLabel, renderPositionGrid, renderSessionChannelAnalysis, connectDecoder, disconnectDecoder, applyCompetitorCorrection, invalidateCompetitorLastLap, restoreCompetitorLastInvalidLap, startOperationalSession, finishOperationalSession, cancelRaceStart, triggerRaceAudio, getStartLightState: () => raceAudioEngine.getStartLightState(), saveState, updateHeaderState, renderView, normalizeDriver, normalizeCar, processDecoderMessage, getSelectedLeaderboardKey: () => selectedLeaderboardKey, setSelectedLeaderboardKey: (value) => { selectedLeaderboardKey = value; }, getQuickAddDraft: () => quickAddDraft, setQuickAddDraft: (value) => { quickAddDraft = value; }, getPassingValidationLabel, isCountedPassing, getCompetitorPassings, getManualCorrectionSummary, formatTeamActiveMemberLabel, lastFinishAnnouncementSessionId: () => lastFinishAnnouncementSessionId, setLastFinishAnnouncementSessionId: (value) => { lastFinishAnnouncementSessionId = value; }, lastOverlayLeaderKeyBySession, lastOverlayTop3BySession, overlayEvents: () => overlayEvents, setOverlayEvents: (value) => { overlayEvents = value; }, sessionReplay, syncTrainingLedger, setCompetitorLapStatus, getLiveSession, selectLiveSession: (id) => selectOperationalSession(id), openRaceDay: () => navigateToView("race_day"), openJudging: (rowKey) => { selectedJudgeKey = rowKey; selectedLeaderboardKey = null; navigateToView("judging"); } });
|
||||||
const renderJudging = () => renderJudgingView({ 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({ 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 });
|
||||||
@@ -881,6 +883,20 @@ const TRANSLATIONS = {
|
|||||||
"race_day.activate": "Välj session",
|
"race_day.activate": "Välj session",
|
||||||
"race_day.finish": "Avsluta heat",
|
"race_day.finish": "Avsluta heat",
|
||||||
"race_day.start_list": "Startlista",
|
"race_day.start_list": "Startlista",
|
||||||
|
"race_day.live_title": "Live: {name}",
|
||||||
|
"race_day.live_title_done": "Resultat: {name}",
|
||||||
|
"race_day.live_hint": "Uppdateras varje sekund. Lila = heatets snabbaste varv, grönt = personbästa på senaste varvet, stapeln = hur långt in på varvet bilen är (röd = sen).",
|
||||||
|
"race_day.live_pos": "Pos",
|
||||||
|
"race_day.live_driver": "Förare",
|
||||||
|
"race_day.live_laps": "Varv",
|
||||||
|
"race_day.live_last": "Senaste",
|
||||||
|
"race_day.live_best": "Bästa",
|
||||||
|
"race_day.live_gap": "Till bilen före",
|
||||||
|
"race_day.live_leader": "Till ledaren",
|
||||||
|
"race_day.live_estimate": "Beräknat slut",
|
||||||
|
"race_day.live_result": "Resultat",
|
||||||
|
"race_day.live_seed": "Seedning",
|
||||||
|
"race_day.live_empty": "Inga varv ännu.",
|
||||||
"race_day.no_start_list": "Ingen startlista finns för sessionen.",
|
"race_day.no_start_list": "Ingen startlista finns för sessionen.",
|
||||||
"sync.connecting": "Ansluter till servern",
|
"sync.connecting": "Ansluter till servern",
|
||||||
"sync.connected": "Server ansluten",
|
"sync.connected": "Server ansluten",
|
||||||
@@ -2585,7 +2601,7 @@ const TRANSLATIONS = {
|
|||||||
"guide.race_day_3": "3. Förkontrollen visar blockerare först, sedan varningar och godkända kontroller. Knapparna vid problemen öppnar relevant meny; min/max kan rättas direkt i Race Day. Förkontrollen blockerar start när Main decoder är offline, deltagare eller transpondrar saknas, transpondrar är dubbla, varvfönstret är ogiltigt eller en positionsgrid är ofullständig.",
|
"guide.race_day_3": "3. Förkontrollen visar blockerare först, sedan varningar och godkända kontroller. Knapparna vid problemen öppnar relevant meny; min/max kan rättas direkt i Race Day. Förkontrollen blockerar start när Main decoder är offline, deltagare eller transpondrar saknas, transpondrar är dubbla, varvfönstret är ogiltigt eller en positionsgrid är ofullständig.",
|
||||||
"guide.race_day_4": "4. Gula kontroller är varningar. Valfria split-/depådecoders, backend och ljud visas tydligt men ändrar inte vanlig varvräkning.",
|
"guide.race_day_4": "4. Gula kontroller är varningar. Valfria split-/depådecoders, backend och ljud visas tydligt men ändrar inte vanlig varvräkning.",
|
||||||
"guide.race_day_5": "5. Vid start synkas state till backend och en konsistent SQLite-backup skapas i data/backups innan den befintliga audio- och starttonssekvensen körs. De 30 senaste sparas.",
|
"guide.race_day_5": "5. Vid start synkas state till backend och en konsistent SQLite-backup skapas i data/backups innan den befintliga audio- och starttonssekvensen körs. De 30 senaste sparas.",
|
||||||
"guide.race_day_6": "6. Använd Race Day för start, paus, fortsätt och avslut. Menyn visar server- och sparstatus separat från decodern. Vid sparfel: behåll fliken öppen och klicka Försök igen; väntande ändringar är inte bekräftat sparade på servern. Tidtagning, Domare och Overlay finns som direkta genvägar. Lokal restore kräver stoppad server och npm run backup:restore -- <fil.sqlite> --confirm. Ett avbrutet eller klart heat, kval eller final körs om med ↻ Kör om: varv, resultat och klocka nollställs, sedan trycker du Starta.",
|
"guide.race_day_6": "6. Använd Race Day för start, paus, fortsätt och avslut. Menyn visar server- och sparstatus separat från decodern. Vid sparfel: behåll fliken öppen och klicka Försök igen; väntande ändringar är inte bekräftat sparade på servern. Tidtagning, Domare och Overlay finns som direkta genvägar. Lokal restore kräver stoppad server och npm run backup:restore -- <fil.sqlite> --confirm. Ett avbrutet eller klart heat, kval eller final körs om med ↻ Kör om: varv, resultat och klocka nollställs, sedan trycker du Starta. Medan heatet pågår visar Race Day racet live under klockan: ordning, varv, senaste och bästa varv, avstånd och beräknat slut - race controllern behöver ingen annan vy.",
|
||||||
"guide.race_day_7": "7. Session replay i Tidtagning spelar upp sparade passeringar i ett isolerat testläge. Välj session, ladda och kör i 1x, 2x, 5x eller 10x utan att ändra originalresultat eller träningsstatistik.",
|
"guide.race_day_7": "7. Session replay i Tidtagning spelar upp sparade passeringar i ett isolerat testläge. Välj session, ladda och kör i 1x, 2x, 5x eller 10x utan att ändra originalresultat eller träningsstatistik.",
|
||||||
"guide.race_day_8": "8. Redan när du registrerar eller ändrar en förare under Förare varnar systemet om transpondern redan används av en annan förare (t.ex. i fel klass) och namnger vem - ett komplement till förkontrollens kontroll av dubbla transpondrar inom samma heat. Samma person som kör flera klasser med sin egen transponder flaggas aldrig.",
|
"guide.race_day_8": "8. Redan när du registrerar eller ändrar en förare under Förare varnar systemet om transpondern redan används av en annan förare (t.ex. i fel klass) och namnger vem - ett komplement till förkontrollens kontroll av dubbla transpondrar inom samma heat. Samma person som kör flera klasser med sin egen transponder flaggas aldrig.",
|
||||||
"guide.race_day_9": "9. Kör ni på ett nät där fler har åtkomst (t.ex. arenans WiFi)? Slå på Admin-PIN under Inställningar -> System & backup. Då kräver alla ändringar PIN - resultat, inställningar och uppdatering - medan visning och publika overlay-/träningslänkar fungerar som vanligt. Varje webbläsare loggar in en gång och kommer ihåg det i 30 dagar.",
|
"guide.race_day_9": "9. Kör ni på ett nät där fler har åtkomst (t.ex. arenans WiFi)? Slå på Admin-PIN under Inställningar -> System & backup. Då kräver alla ändringar PIN - resultat, inställningar och uppdatering - medan visning och publika overlay-/träningslänkar fungerar som vanligt. Varje webbläsare loggar in en gång och kommer ihåg det i 30 dagar.",
|
||||||
@@ -2751,6 +2767,20 @@ const TRANSLATIONS = {
|
|||||||
"race_day.activate": "Select session",
|
"race_day.activate": "Select session",
|
||||||
"race_day.finish": "Finish heat",
|
"race_day.finish": "Finish heat",
|
||||||
"race_day.start_list": "Start list",
|
"race_day.start_list": "Start list",
|
||||||
|
"race_day.live_title": "Live: {name}",
|
||||||
|
"race_day.live_title_done": "Result: {name}",
|
||||||
|
"race_day.live_hint": "Updated every second. Purple = the heat's fastest lap, green = a personal best on the last lap, the bar = how far into the lap the car is (red = late).",
|
||||||
|
"race_day.live_pos": "Pos",
|
||||||
|
"race_day.live_driver": "Driver",
|
||||||
|
"race_day.live_laps": "Laps",
|
||||||
|
"race_day.live_last": "Last",
|
||||||
|
"race_day.live_best": "Best",
|
||||||
|
"race_day.live_gap": "To car ahead",
|
||||||
|
"race_day.live_leader": "To leader",
|
||||||
|
"race_day.live_estimate": "Estimated finish",
|
||||||
|
"race_day.live_result": "Result",
|
||||||
|
"race_day.live_seed": "Seeding",
|
||||||
|
"race_day.live_empty": "No laps yet.",
|
||||||
"race_day.no_start_list": "No start list is available for this session.",
|
"race_day.no_start_list": "No start list is available for this session.",
|
||||||
"sync.connecting": "Connecting to server",
|
"sync.connecting": "Connecting to server",
|
||||||
"sync.connected": "Server connected",
|
"sync.connected": "Server connected",
|
||||||
@@ -4455,7 +4485,7 @@ const TRANSLATIONS = {
|
|||||||
"guide.race_day_3": "3. Preflight lists blockers first, then warnings and passed checks. Buttons beside issues open the relevant menu; min/max can be corrected directly in Race Day. Preflight blocks start when the Main decoder is offline, participants or transponders are missing, transponders are duplicated, the lap window is invalid, or a position grid is incomplete.",
|
"guide.race_day_3": "3. Preflight lists blockers first, then warnings and passed checks. Buttons beside issues open the relevant menu; min/max can be corrected directly in Race Day. Preflight blocks start when the Main decoder is offline, participants or transponders are missing, transponders are duplicated, the lap window is invalid, or a position grid is incomplete.",
|
||||||
"guide.race_day_4": "4. Yellow checks are warnings. Optional split/pit decoders, backend, and audio are visible but do not change normal lap counting.",
|
"guide.race_day_4": "4. Yellow checks are warnings. Optional split/pit decoders, backend, and audio are visible but do not change normal lap counting.",
|
||||||
"guide.race_day_5": "5. Starting synchronizes state to the backend and creates a consistent SQLite backup in data/backups before the existing audio and start-tone sequence runs. The latest 30 are retained.",
|
"guide.race_day_5": "5. Starting synchronizes state to the backend and creates a consistent SQLite backup in data/backups before the existing audio and start-tone sequence runs. The latest 30 are retained.",
|
||||||
"guide.race_day_6": "6. Use Race Day for start, pause, resume, and finish. The menu shows server/save status separately from the decoder. On save failure, keep the tab open and click Retry; pending changes are not confirmed saved on the server. Timing, Judging, and Overlay remain one click away. Local restore requires a stopped server and npm run backup:restore -- <file.sqlite> --confirm. A stopped or finished heat, qualifier or final is run again with ↻ Run again: laps, results and clock are reset, then press Start.",
|
"guide.race_day_6": "6. Use Race Day for start, pause, resume, and finish. The menu shows server/save status separately from the decoder. On save failure, keep the tab open and click Retry; pending changes are not confirmed saved on the server. Timing, Judging, and Overlay remain one click away. Local restore requires a stopped server and npm run backup:restore -- <file.sqlite> --confirm. A stopped or finished heat, qualifier or final is run again with ↻ Run again: laps, results and clock are reset, then press Start. While the heat runs, Race Day shows the race live under the clock: order, laps, last and best lap, gaps and estimated finish - the race controller needs no other view.",
|
||||||
"guide.race_day_7": "7. Session replay in Timing replays saved passings in an isolated test mode. Select a session, load it, and run at 1x, 2x, 5x, or 10x without modifying source results or training statistics.",
|
"guide.race_day_7": "7. Session replay in Timing replays saved passings in an isolated test mode. Select a session, load it, and run at 1x, 2x, 5x, or 10x without modifying source results or training statistics.",
|
||||||
"guide.race_day_8": "8. Already when you register or edit a driver under Drivers, the system warns if the transponder is already used by a different driver (e.g. in the wrong class) and names who - a complement to the preflight's duplicate-transponder check within a single heat. The same person racing multiple classes on their own transponder is never flagged.",
|
"guide.race_day_8": "8. Already when you register or edit a driver under Drivers, the system warns if the transponder is already used by a different driver (e.g. in the wrong class) and names who - a complement to the preflight's duplicate-transponder check within a single heat. The same person racing multiple classes on their own transponder is never flagged.",
|
||||||
"guide.race_day_9": "9. Running on a network others can reach (e.g. the venue WiFi)? Turn on the Admin PIN under Settings -> System & backup. Every change then needs the PIN - results, settings and updates - while viewing and public overlay/training links work as usual. Each browser logs in once and is remembered for 30 days.",
|
"guide.race_day_9": "9. Running on a network others can reach (e.g. the venue WiFi)? Turn on the Admin PIN under Settings -> System & backup. Every change then needs the PIN - results, settings and updates - while viewing and public overlay/training links work as usual. Each browser logs in once and is remembered for 30 days.",
|
||||||
|
|||||||
+54
-1
@@ -1,6 +1,7 @@
|
|||||||
import { isPracticeSessionType } from "./track_layouts_logic.js";
|
import { isPracticeSessionType } from "./track_layouts_logic.js";
|
||||||
import { renderTrackLayoutBar, bindTrackLayoutBar } from "./track_layout_bar.js";
|
import { renderTrackLayoutBar, bindTrackLayoutBar } from "./track_layout_bar.js";
|
||||||
import { PROLOGUE_OPTIONS_SEC, formatPrologueOption } from "./prologue_logic.js";
|
import { PROLOGUE_OPTIONS_SEC, formatPrologueOption } from "./prologue_logic.js";
|
||||||
|
import { estimateFinish } from "./timing_logic.js";
|
||||||
export function getRaceDayCheckAction(item, session) {
|
export function getRaceDayCheckAction(item, session) {
|
||||||
if (item.level === "ok") return null;
|
if (item.level === "ok") return null;
|
||||||
if (["backend", "decoder", "split_decoder", "pit_decoders", "audio"].includes(item.id)) {
|
if (["backend", "decoder", "split_decoder", "pit_decoders", "audio"].includes(item.id)) {
|
||||||
@@ -167,6 +168,54 @@ function bindWarmupPanel(panel, deps, session) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Live race for the race controller ------------------------------------------------
|
||||||
|
// The running order with laps, last and best lap, gaps and where each car will end, right on
|
||||||
|
// Race Day. Repainted once a second (refreshRaceDayLive) and on every passing (full render).
|
||||||
|
let lastLiveDeps = null;
|
||||||
|
const showsLivePanel = (session) => Boolean(session && !isPracticeSessionType(session.type)
|
||||||
|
&& (["running", "paused"].includes(session.status) || (["finished", "stopped"].includes(session.status) && session.startedAt)));
|
||||||
|
|
||||||
|
function renderLivePanelInner({ t, escapeHtml, formatLap, formatRaceClock, buildLeaderboard, getSessionTargetMs }, session) {
|
||||||
|
const rows = buildLeaderboard(session);
|
||||||
|
const seedRanked = ["practice", "qualification"].includes(session.type) && Number(session.seedBestLapCount || 0) > 0;
|
||||||
|
const targetMs = seedRanked ? null : getSessionTargetMs(session);
|
||||||
|
const fastestMs = Math.min(...rows.map((row) => Number(row.bestLapMs) || Infinity));
|
||||||
|
const done = ["finished", "stopped"].includes(session.status);
|
||||||
|
const lap = (ms) => (ms > 0 ? formatLap(ms) : "-");
|
||||||
|
const body = rows.map((row, index) => {
|
||||||
|
const estimate = !done && targetMs ? estimateFinish(row, targetMs) : null;
|
||||||
|
const bestIsFastest = row.bestLapMs > 0 && row.bestLapMs === fastestMs;
|
||||||
|
const lastIsBest = row.lastLapMs > 0 && row.lastLapMs === row.bestLapMs;
|
||||||
|
const flag = done || row.personalTimeUp ? " 🏁" : "";
|
||||||
|
const progress = Math.round(Math.min(1, row.predictedProgress || 0) * 100);
|
||||||
|
return `<tr class="${row.invalidPending ? "is-invalid" : ""}">
|
||||||
|
<td class="live-pos">${index + 1}</td>
|
||||||
|
<td class="live-driver"><strong>${escapeHtml(row.displayName || row.driverName || row.transponder || "-")}${flag}</strong>${row.invalidPending ? ` <span class="live-warn" title="${escapeHtml(row.invalidLabel || "")}">⚠</span>` : ""}
|
||||||
|
${done ? "" : `<span class="live-lap-bar" aria-hidden="true"><span class="is-${escapeHtml(row.predictionTone || "good")}" style="width:${progress}%"></span></span>`}</td>
|
||||||
|
<td class="live-num">${row.laps}</td>
|
||||||
|
<td class="live-num ${lastIsBest ? "is-pb" : ""}">${lap(row.lastLapMs)}</td>
|
||||||
|
<td class="live-num ${bestIsFastest ? "is-fastest" : ""}">${lap(row.bestLapMs)}</td>
|
||||||
|
<td class="live-num">${escapeHtml(index === 0 ? "-" : row.gapAhead || "-")}</td>
|
||||||
|
<td class="live-num">${escapeHtml(index === 0 ? "-" : row.leaderGap || "-")}</td>
|
||||||
|
<td class="live-num">${seedRanked ? escapeHtml(row.resultDisplay || "-") : done ? escapeHtml(`${row.laps} · ${formatRaceClock(row.totalElapsedMs)}`) : estimate ? escapeHtml(`${estimate.laps} · ${formatRaceClock(estimate.timeMs)}`) : "-"}</td>
|
||||||
|
</tr>`;
|
||||||
|
}).join("");
|
||||||
|
const lastColumn = seedRanked ? t("race_day.live_seed") : done ? t("race_day.live_result") : t("race_day.live_estimate");
|
||||||
|
return `<div class="panel-header"><div><h3>${escapeHtml(t(done ? "race_day.live_title_done" : "race_day.live_title", { name: session.name }))}</h3><p class="hint">${escapeHtml(t("race_day.live_hint"))}</p></div><span class="pill ${done ? "" : "pill-green"}">${rows.length}</span></div>
|
||||||
|
<div class="panel-body">${rows.length ? `<div class="table-wrap"><table class="race-day-live-table">
|
||||||
|
<thead><tr><th>${t("race_day.live_pos")}</th><th>${t("race_day.live_driver")}</th><th>${t("race_day.live_laps")}</th><th>${t("race_day.live_last")}</th><th>${t("race_day.live_best")}</th><th>${t("race_day.live_gap")}</th><th>${t("race_day.live_leader")}</th><th>${lastColumn}</th></tr></thead>
|
||||||
|
<tbody>${body}</tbody></table></div>` : `<p class="hint">${t("race_day.live_empty")}</p>`}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once a second by the clock tick in app.js; touches only the live panel.
|
||||||
|
export function refreshRaceDayLive() {
|
||||||
|
const panel = document.getElementById("raceDayLive");
|
||||||
|
if (!panel || !lastLiveDeps) return;
|
||||||
|
const session = lastLiveDeps.getSession();
|
||||||
|
if (!showsLivePanel(session)) return;
|
||||||
|
panel.innerHTML = renderLivePanelInner(lastLiveDeps, session);
|
||||||
|
}
|
||||||
|
|
||||||
// Called by the prologue timer in app.js (5x a second) - touches only the clock text.
|
// Called by the prologue timer in app.js (5x a second) - touches only the clock text.
|
||||||
export function refreshRaceDayPrologueClock(remainingMs) {
|
export function refreshRaceDayPrologueClock(remainingMs) {
|
||||||
document.querySelectorAll("[data-prologue-clock]").forEach((node) => { node.textContent = formatMmSs(remainingMs); });
|
document.querySelectorAll("[data-prologue-clock]").forEach((node) => { node.textContent = formatMmSs(remainingMs); });
|
||||||
@@ -210,6 +259,7 @@ export function renderRaceDayView(deps) {
|
|||||||
startRacePrologue, holdRacePrologue, resumeRacePrologue, setRacePrologueRemaining, cancelRacePrologue, goRacePrologue,
|
startRacePrologue, holdRacePrologue, resumeRacePrologue, setRacePrologueRemaining, cancelRacePrologue, goRacePrologue,
|
||||||
isStartPending, renderSuspectLapsPanel = () => "", setCompetitorLapStatus = () => false, getLiveSession = () => null,
|
isStartPending, renderSuspectLapsPanel = () => "", setCompetitorLapStatus = () => false, getLiveSession = () => null,
|
||||||
resetSessionData = () => false, startPracticeNow = async () => false, findOpenPracticeToContinue = () => null,
|
resetSessionData = () => false, startPracticeNow = async () => false, findOpenPracticeToContinue = () => null,
|
||||||
|
buildLeaderboard = () => [], getSessionTargetMs = () => null, formatRaceClock = (ms) => String(ms),
|
||||||
} = deps;
|
} = deps;
|
||||||
const queue = buildRaceDayQueue(state);
|
const queue = buildRaceDayQueue(state);
|
||||||
const session = queue.current;
|
const session = queue.current;
|
||||||
@@ -266,6 +316,7 @@ export function renderRaceDayView(deps) {
|
|||||||
? `<div class="race-day-clock is-prologue"><strong data-prologue-clock>${formatMmSs(warmupForChecks.remainingMs)}</strong><span>${t("prologue.to_start")}</span></div>`
|
? `<div class="race-day-clock is-prologue"><strong data-prologue-clock>${formatMmSs(warmupForChecks.remainingMs)}</strong><span>${t("prologue.to_start")}</span></div>`
|
||||||
: `<div class="race-day-clock"><strong data-race-day-clock>${clock}</strong><span>${session ? escapeHtml(getStatusLabel(session.status)) : t("race_day.none")}</span></div>`}
|
: `<div class="race-day-clock"><strong data-race-day-clock>${clock}</strong><span>${session ? escapeHtml(getStatusLabel(session.status)) : t("race_day.none")}</span></div>`}
|
||||||
</section>
|
</section>
|
||||||
|
${showsLivePanel(session) ? `<section class="panel race-day-live" id="raceDayLive"></section>` : ""}
|
||||||
|
|
||||||
<div class="race-day-layout">
|
<div class="race-day-layout">
|
||||||
<div class="race-day-main">
|
<div class="race-day-main">
|
||||||
@@ -313,7 +364,7 @@ export function renderRaceDayView(deps) {
|
|||||||
${showsWarmupPanel(session) ? `<section class="panel mt-16" id="raceDayWarmup"></section>` : ""}
|
${showsWarmupPanel(session) ? `<section class="panel mt-16" id="raceDayWarmup"></section>` : ""}
|
||||||
${session ? renderSuspectLapsPanel(session) : ""}
|
${session ? renderSuspectLapsPanel(session) : ""}
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel" ${isLiveSession ? "hidden" : ""}>
|
||||||
<div class="panel-header"><h3>${t("race_day.start_list")}</h3><span class="pill">${grid.length}</span></div>
|
<div class="panel-header"><h3>${t("race_day.start_list")}</h3><span class="pill">${grid.length}</span></div>
|
||||||
<div class="panel-body race-day-grid-list">
|
<div class="panel-body race-day-grid-list">
|
||||||
${grid.length ? grid.map((entry) => `<article><span>${entry.slot}</span><strong>${escapeHtml(entry.name)}</strong><small>${escapeHtml(entry.meta || "-")}</small></article>`).join("") : `<p class="hint">${t("race_day.no_start_list")}</p>`}
|
${grid.length ? grid.map((entry) => `<article><span>${entry.slot}</span><strong>${escapeHtml(entry.name)}</strong><small>${escapeHtml(entry.meta || "-")}</small></article>`).join("") : `<p class="hint">${t("race_day.no_start_list")}</p>`}
|
||||||
@@ -387,6 +438,8 @@ export function renderRaceDayView(deps) {
|
|||||||
bindTrackLayoutBar(dom.view, { state, t, addTrackLayout, renderView });
|
bindTrackLayoutBar(dom.view, { state, t, addTrackLayout, renderView });
|
||||||
lastWarmupDeps = { t, escapeHtml, renderView, getRaceDayWarmupCheck, setDriverTransponder, getSession: () => buildRaceDayQueue(state).current };
|
lastWarmupDeps = { t, escapeHtml, renderView, getRaceDayWarmupCheck, setDriverTransponder, getSession: () => buildRaceDayQueue(state).current };
|
||||||
paintWarmupPanel();
|
paintWarmupPanel();
|
||||||
|
lastLiveDeps = { t, escapeHtml, formatLap, formatRaceClock, buildLeaderboard, getSessionTargetMs, getSession: () => buildRaceDayQueue(state).current };
|
||||||
|
refreshRaceDayLive();
|
||||||
document.getElementById("raceDayStart")?.addEventListener("click", async () => {
|
document.getElementById("raceDayStart")?.addEventListener("click", async () => {
|
||||||
if (!session || !preflight.ready) return;
|
if (!session || !preflight.ready) return;
|
||||||
if (!isSelected) selectSession(session.id, { render: false });
|
if (!isSelected) selectSession(session.id, { render: false });
|
||||||
|
|||||||
@@ -4734,3 +4734,24 @@ tr.is-removed td.lap-actions {
|
|||||||
.overlay-race-list-compact .overlay-decoder-meta {
|
.overlay-race-list-compact .overlay-decoder-meta {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Race Day live race: big, readable from a distance for the race controller. */
|
||||||
|
.race-day-live { margin-top: 16px; }
|
||||||
|
.race-day-live-table { width: 100%; border-collapse: collapse; font-size: 1.15rem; }
|
||||||
|
.race-day-live-table th { text-align: left; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 10px; white-space: nowrap; }
|
||||||
|
.race-day-live-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
|
||||||
|
.race-day-live-table .live-pos { font-size: 1.5rem; font-weight: 800; width: 2.5em; }
|
||||||
|
.race-day-live-table .live-driver strong { font-size: 1.2rem; }
|
||||||
|
.race-day-live-table .live-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
|
.race-day-live-table .is-fastest { color: #b77dff; font-weight: 800; }
|
||||||
|
.race-day-live-table .is-pb { color: var(--ok); font-weight: 700; }
|
||||||
|
.race-day-live-table tr.is-invalid td { background: var(--danger-soft, rgba(239, 68, 68, 0.1)); }
|
||||||
|
.race-day-live-table .live-warn { color: var(--warn); }
|
||||||
|
.live-lap-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--line); overflow: hidden; max-width: 220px; }
|
||||||
|
.live-lap-bar > span { display: block; height: 100%; background: var(--ok); }
|
||||||
|
.live-lap-bar > .is-warn { background: var(--warn); }
|
||||||
|
.live-lap-bar > .is-late { background: var(--danger); }
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.race-day-live-table { font-size: 1rem; }
|
||||||
|
.race-day-live-table th:nth-child(7), .race-day-live-table td:nth-child(7) { display: none; }
|
||||||
|
}
|
||||||
@@ -1033,3 +1033,16 @@ export function buildFinalStandings(event, { getSessionsForEvent, buildLeaderboa
|
|||||||
return a.orderingIndex - b.orderingIndex;
|
return a.orderingIndex - b.orderingIndex;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Where a car ends when its time is up, at its recent pace (its last two laps, else its
|
||||||
|
// average): the laps it will have and the time of its last crossing. Once over time, the car
|
||||||
|
// takes the flag on its next crossing. null for untimed sessions or before the first lap.
|
||||||
|
export function estimateFinish(row, targetMs) {
|
||||||
|
const laps = Number(row?.laps || 0);
|
||||||
|
const elapsedMs = Number(row?.totalElapsedMs || 0);
|
||||||
|
if (!targetMs || laps < 1 || elapsedMs <= 0) return null;
|
||||||
|
const recent = [row.lastLapMs, row.previousLapMs].map(Number).filter((value) => value > 0);
|
||||||
|
const paceMs = recent.length ? recent.reduce((sum, value) => sum + value, 0) / recent.length : elapsedMs / laps;
|
||||||
|
const moreLaps = elapsedMs >= targetMs ? 0 : Math.ceil((targetMs - elapsedMs) / paceMs);
|
||||||
|
return { laps: laps + moreLaps, timeMs: Math.round(elapsedMs + moreLaps * paceMs), paceMs: Math.round(paceMs) };
|
||||||
|
}
|
||||||
@@ -66,6 +66,28 @@ export async function runRaceDayQuickSmoke({ evaluate, navigate, savedState, wai
|
|||||||
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayStart")`)), "Start is offered again");
|
await waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayStart")`)), "Start is offered again");
|
||||||
console.log("PASS a finished heat can be picked and reset: clock to zero, laps cleared, Start again");
|
console.log("PASS a finished heat can be picked and reset: clock to zero, laps cleared, Start again");
|
||||||
|
|
||||||
|
// The race controller follows the heat on Race Day: order, laps, last/best lap, estimate.
|
||||||
|
const liveAt = Date.now() - 60000;
|
||||||
|
const competitor = (key, name, laps, lastLapMs, bestLapMs, elapsedMs) => ({ key, driverName: name, displayName: name, laps, lastLapMs, bestLapMs, startTimestamp: liveAt, lastTimestamp: liveAt + elapsedMs });
|
||||||
|
await patchState({
|
||||||
|
sessions: [...(await savedState()).sessions.filter((session) => session.status !== "running"), { id: "rq_live", eventId: "rq_event", name: "RQ Heat 3", type: "heat", status: "running", durationMin: 5, startMode: "mass", startedAt: liveAt }],
|
||||||
|
resultsBySession: { ...(await savedState()).resultsBySession, rq_live: { passings: [], adjustments: [], competitors: {
|
||||||
|
slow: competitor("slow", "Slow Sam", 2, 26000, 25000, 52000),
|
||||||
|
fast: competitor("fast", "Fast Fia", 3, 19000, 18500, 57000),
|
||||||
|
} } },
|
||||||
|
activeSessionId: "rq_live",
|
||||||
|
});
|
||||||
|
await navigate("race_day", "raceDayLive");
|
||||||
|
const liveRows = await evaluate(`JSON.stringify([...document.querySelectorAll("#raceDayLive tbody tr")].map((row) => [...row.cells].map((cell) => cell.textContent.trim())))`);
|
||||||
|
const [first, second] = JSON.parse(liveRows);
|
||||||
|
assert.deepEqual([first[0], first[1], first[2], second[1], second[2]], ["1", "Fast Fia", "3", "Slow Sam", "2"], "the running order with laps");
|
||||||
|
assert.match(first[3], /19\.0/, "last lap");
|
||||||
|
assert.match(first[4], /18\.5/, "best lap");
|
||||||
|
assert.match(first[7], /^16 · /, "estimated laps when the time is up");
|
||||||
|
assert.equal(await evaluate(`document.querySelector("#raceDayLive .is-fastest")?.closest("tr").cells[1].textContent.includes("Fast Fia")`), true, "the heat's fastest lap is marked");
|
||||||
|
await patchState({ sessions: (await savedState()).sessions.map((session) => (session.id === "rq_live" ? { ...session, status: "finished", endedAt: Date.now() } : session)) });
|
||||||
|
console.log("PASS Race Day shows the live race: order, laps, last and best lap, gaps and estimated finish");
|
||||||
|
|
||||||
await navigate("timing", "activeSessionSelect");
|
await navigate("timing", "activeSessionSelect");
|
||||||
assert.equal(await evaluate(`Boolean(document.getElementById("startSession") || document.getElementById("resetSession") || document.getElementById("stopSession"))`), false, "no run controls on Timing");
|
assert.equal(await evaluate(`Boolean(document.getElementById("startSession") || document.getElementById("resetSession") || document.getElementById("stopSession"))`), false, "no run controls on Timing");
|
||||||
await evaluate(`document.getElementById("timingOpenRaceDay").click()`);
|
await evaluate(`document.getElementById("timingOpenRaceDay").click()`);
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { estimateFinish } from "../src/timing_logic.js";
|
||||||
|
|
||||||
|
test("estimated finish: laps and time when a 5-minute heat is up, at the car's recent pace", () => {
|
||||||
|
// 10 laps in 3:00, last two laps 18 s: 120 s left = 7 more laps (the 7th crosses after 5:00).
|
||||||
|
assert.deepEqual(estimateFinish({ laps: 10, totalElapsedMs: 180000, lastLapMs: 18000, previousLapMs: 18000 }, 300000), { laps: 17, timeMs: 306000, paceMs: 18000 });
|
||||||
|
// No recent laps known: the average lap.
|
||||||
|
assert.equal(estimateFinish({ laps: 4, totalElapsedMs: 80000 }, 300000).paceMs, 20000);
|
||||||
|
// Over time: the laps it has are its result.
|
||||||
|
assert.deepEqual(estimateFinish({ laps: 16, totalElapsedMs: 301000, lastLapMs: 19000 }, 300000), { laps: 16, timeMs: 301000, paceMs: 19000 });
|
||||||
|
assert.equal(estimateFinish({ laps: 0, totalElapsedMs: 0 }, 300000), null, "no lap yet");
|
||||||
|
assert.equal(estimateFinish({ laps: 5, totalElapsedMs: 90000 }, null), null, "untimed session");
|
||||||
|
});
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import "./auth.test.js";
|
import "./auth.test.js";
|
||||||
|
import "./race_day_live.test.js";
|
||||||
import "./series_next_step.test.js";
|
import "./series_next_step.test.js";
|
||||||
import "./race_day_sessions.test.js";
|
import "./race_day_sessions.test.js";
|
||||||
import "./overlay_leaderboard.test.js";
|
import "./overlay_leaderboard.test.js";
|
||||||
|
|||||||
Reference in new issue
Block a user