feat(ux): run sessions from Race Day with quick actions
Race Day gets Start practice, New track layout and Create race, a session picker, only the buttons that apply, and New practice day (replaces Reset data on Timing; laps stay in the training stats). Timing is for following and links to Race Day. The Dashboard shows the three common tasks first. Guide, READMEs, screenshot and the "Run a session" video follow the flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a6789f42f
commit
c4df90706a
23 files changed
+344
-111
No files matched your search
@@ -8,6 +8,16 @@ The application version is maintained in `package.json` and displayed in the adm
|
||||
|
||||
No changes recorded yet.
|
||||
|
||||
## 1.41.0 - 2026-10-17
|
||||
|
||||
### Changed
|
||||
|
||||
- **Race Day is where sessions are run.** Quick actions at the top: **Start practice** (continues today's Open Practice or creates and starts a new one), **New track layout** (only for practice; the running practice moves onto it) and **Create race**. A session picker switches session without going to Timing. Only the buttons that apply are shown (no greyed-out Pause before a start), with practice wording (Pause practice / Finish practice) and no start lights for practice.
|
||||
- **New practice day** on Race Day replaces "Reset data" on Timing: clears today's timing for the selected Open Practice while every lap stays in the training stats.
|
||||
- **Timing is for following.** Start, stop and reset moved to Race Day; Timing keeps the session picker, the leaderboard and lap clean-up, with a link to Race Day. Opening a session from Race Setup now goes to Race Day.
|
||||
- The Dashboard shows the three common tasks first: Start practice, Create race and Series / cup.
|
||||
- The guide, both READMEs, the Race Day screenshot and the "Run a session" video follow the new flow (count-down, hold, To 10 s, pause, finish).
|
||||
|
||||
## 1.40.0 - 2026-10-17
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -69,7 +69,7 @@ Click an image to open the full-resolution version.
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%"><a href="docs/screenshots/guide.jpg"><img src="docs/screenshots/guide.jpg" alt="In-app setup guide" /></a><br><strong>In-app setup guide</strong></td>
|
||||
<td width="50%"></td>
|
||||
<td width="50%"><a href="docs/screenshots/race-day.jpg"><img src="docs/screenshots/race-day.jpg" alt="Race Day with quick actions during a running practice" /></a><br><strong>Race Day</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -102,7 +102,9 @@ The menu follows how a race day works: **Start** (Dashboard, Race Day), **Create
|
||||
|
||||
### Race day
|
||||
|
||||
**Race Day** is the operator's page:
|
||||
**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.
|
||||
- **A session picker** and the buttons that apply right now: Start, Pause, Resume, Finish, and for practice **New practice day**. Practice uses plain words and has no start lights.
|
||||
- The **heat queue** shows the current, next and after-next heat.
|
||||
- **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.
|
||||
@@ -189,7 +191,7 @@ Menu **Series / cup** runs a championship over any number of rounds, with freely
|
||||
|
||||
**Practice sessions:**
|
||||
- Open Practice can run all season; Free Practice is a rolling best-lap session.
|
||||
- **Reset data** on Timing clears the session for a new day, but every lap stays in the training statistics.
|
||||
- **Start practice** on the Dashboard or Race Day continues the running Open Practice, or creates and starts one. **New practice day** on Race Day clears the day's laps for a new evening; every lap stays in the training statistics.
|
||||
|
||||
**Track layouts:**
|
||||
- Press **New layout** (on Training stats, Race Day or the Dashboard) when the track is rebuilt. A running practice moves onto the new layout, and best laps start over.
|
||||
|
||||
+5
-3
@@ -75,7 +75,7 @@ Klicka på en bild för full upplösning.
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%"><a href="docs/screenshots/guide.jpg"><img src="docs/screenshots/guide.jpg" alt="Inbyggd guide" /></a><br><strong>Inbyggd guide</strong></td>
|
||||
<td width="50%"></td>
|
||||
<td width="50%"><a href="docs/screenshots/race-day.jpg"><img src="docs/screenshots/race-day.jpg" alt="Race Day med snabbval under en pågående träning" /></a><br><strong>Race Day</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -115,7 +115,9 @@ Gränssnittet finns på svenska och engelska.
|
||||
|
||||
### Race day
|
||||
|
||||
**Race Day** är operatörens sida:
|
||||
**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.
|
||||
- **En sessionsväljare** och de knappar som gäller just nu: Start, Pausa, Fortsätt, Avsluta, och för träning **Ny träningsdag**. Träning använder vanliga ord och har inga startljus.
|
||||
- **Heat-kön** visar aktuellt, nästa och därpå följande heat.
|
||||
- **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.
|
||||
@@ -202,7 +204,7 @@ Menyn **Serier / cup** kör ett mästerskap över valfritt antal deltävlingar,
|
||||
|
||||
**Träningspass:**
|
||||
- Open Practice kan köras hela säsongen; Free Practice rankar på bästa varv.
|
||||
- **Nollställ data** i Tidtagning rensar passet inför en ny dag, men alla varv finns kvar i träningsstatistiken.
|
||||
- **Starta träning** på Översikten eller Race Day fortsätter pågående Open Practice, eller skapar och startar en. **Ny träningsdag** på Race Day nollställer dagens varv inför en ny kväll; alla varv finns kvar i träningsstatistiken.
|
||||
|
||||
**Banlayouter:**
|
||||
- Tryck **Ny layout** (på Träningsstatistik, Race Day eller Översikt) när banan byggs om. Ett pågående träningspass flyttas till den nya layouten, och bästa varven börjar om.
|
||||
|
||||
+13
@@ -954,6 +954,19 @@ Verified:
|
||||
- `tests/browser_live_session.js` runs practice A while B is selected, and sends a real decoder passing. It checks that the passing is counted on A and nothing on B, that the notice shows A, and that Show it selects A and removes the notice.
|
||||
- The test fails with the old routing ("the passing is counted on the running practice, not dropped") and passes with the fix. 76 browser scenarios pass.
|
||||
|
||||
## Race Day runs sessions, Timing follows (2026-10-17)
|
||||
|
||||
Reported by the user: non-technical club members found it too hard to start a new Open Practice or a layout in a running practice, and "Reset data" sat on Timing while pause/start/stop sat on Race Day.
|
||||
|
||||
- [x] Race Day quick actions: **Start practice** (`startPracticeNow` continues the running, paused or latest ready Open Practice, otherwise creates and starts one), **New track layout** (practice only) and **Create race**.
|
||||
- [x] Session picker on Race Day, and only the buttons that apply (Start / Pause / Resume / Finish), with practice wording; no start lights for practice.
|
||||
- [x] **New practice day** (`resetSessionData`) on Race Day with a confirm that says the laps stay in the training stats; removed from Timing together with start/stop.
|
||||
- [x] Timing keeps the session picker, leaderboard and lap clean-up, plus a link to Race Day; opening a session from Race Setup goes to Race Day.
|
||||
- [x] Dashboard shows Start practice, Create race and Series / cup first.
|
||||
- [x] Guide, READMEs, `race-day.jpg` and the "Run a session" video updated to the new flow.
|
||||
|
||||
Verified: 266 unit tests and 80 browser scenarios pass, including `tests/browser_race_day_quick.js` (Dashboard Start practice creates, starts and opens a practice on Race Day; the quick layout moves it; the picker switches session; Timing has no run controls). `tests/browser_race_day.js` now checks that buttons are shown only when they apply. Video frames checked: count-down, To 10 s, then Pause/Finish once the heat runs.
|
||||
|
||||
## Documentation maintenance
|
||||
|
||||
- [x] Update the architecture's module/dependency inventory as modules change.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 477 KiB After Width: | Height: | Size: 449 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 369 KiB |
Binary file not shown.
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.40.0",
|
||||
"version": "1.41.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rc-racecore",
|
||||
"version": "1.40.0",
|
||||
"version": "1.41.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.11.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-racecore",
|
||||
"version": "1.40.0",
|
||||
"version": "1.41.0",
|
||||
"private": true,
|
||||
"description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence",
|
||||
"engines": {
|
||||
|
||||
@@ -164,6 +164,26 @@ async function captureShot(name, { setup }) {
|
||||
}
|
||||
|
||||
const shots = {
|
||||
"race-day": {
|
||||
async setup({ evaluate, navigate }) {
|
||||
// A running Open Practice with a few laps, selected: Race Day as the club evening sees it.
|
||||
await navigate("dashboard", "#view");
|
||||
await evaluate(`(async () => {
|
||||
const { state } = await (await fetch("/api/state")).json();
|
||||
const startedAt = Date.now() - 25 * 60000;
|
||||
state.events.push({ id: "shot_op_event", name: "Open Practice", date: new Date().toISOString().slice(0, 10), classId: "", mode: "race", raceConfig: { practiceOnly: true } });
|
||||
state.sessions.push({ id: "shot_op", eventId: "shot_op_event", name: "Open Practice", type: "open_practice", status: "running", startedAt, durationMin: 600, mode: "race" });
|
||||
state.activeSessionId = "shot_op";
|
||||
await fetch("/api/state", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(state) });
|
||||
})()`);
|
||||
await navigate("race_day", "#raceDayQuickPractice");
|
||||
},
|
||||
},
|
||||
"overview-active-session": {
|
||||
async setup({ navigate }) {
|
||||
await navigate("dashboard", "#dashboardQuickPractice");
|
||||
},
|
||||
},
|
||||
series: {
|
||||
async setup({ evaluate, navigate, scrollTo }) {
|
||||
// A series over two of four classes (added out of name order on purpose: the page sorts them).
|
||||
|
||||
@@ -510,26 +510,44 @@ const clips = {
|
||||
await waitFor(async () => (await evaluate('document.getElementById("raceDayStart")?.disabled')) === false, "start enabled once preflight is ready");
|
||||
},
|
||||
steps: [
|
||||
{ text: "This is Race Day, your control center for running a session live." },
|
||||
{ text: "This is Race Day, where every session is run. Practice, a new track layout and new races are one click away at the top." },
|
||||
{
|
||||
text: "Hit Start, and RaceCore runs a countdown before the green light.",
|
||||
async action({ click }) { await click("#raceDayStart"); },
|
||||
text: "Pick a count-down - here thirty seconds - and press Start. The track opens and the announcer calls the time.",
|
||||
async action({ evaluate, click }) {
|
||||
await evaluate(`document.getElementById("raceDayPrologueLength").value = "30"`);
|
||||
await click("#raceDayStart");
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "Cars on the grid? Jump to the last ten seconds, or hold the count-down while they line up.",
|
||||
async action({ click }) { await click('[data-prologue="to10"]'); },
|
||||
},
|
||||
{
|
||||
text: "At three seconds the start lights take over, and the heat starts by itself.",
|
||||
async action({ evaluate }) {
|
||||
await waitFor(async () => Boolean(await evaluate('document.getElementById("raceDayPause")')), "heat running", 20000);
|
||||
},
|
||||
},
|
||||
{ text: "Start lights count down, then the session goes live and the clock starts." },
|
||||
{
|
||||
text: "Pause any time - lap timing stops without losing the session.",
|
||||
async action({ click }) { await click("#raceDayPause"); },
|
||||
},
|
||||
{
|
||||
text: "Resume picks up right where you left off.",
|
||||
async action({ click }) { await click("#raceDayResume"); },
|
||||
async action({ evaluate, click }) {
|
||||
await waitFor(async () => Boolean(await evaluate('document.getElementById("raceDayResume")')), "paused");
|
||||
await click("#raceDayResume");
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "And Finish locks in the results for this session.",
|
||||
async action({ click }) { await click("#raceDayFinish"); },
|
||||
async action({ evaluate, click }) {
|
||||
await waitFor(async () => Boolean(await evaluate('document.getElementById("raceDayFinish")')), "running again");
|
||||
await click("#raceDayFinish");
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "Head over to Timing to see the leaderboard and lap-by-lap results.",
|
||||
text: "Timing is for following: the leaderboard and lap-by-lap results.",
|
||||
async action({ click }) { await click("#raceDayTiming"); },
|
||||
},
|
||||
],
|
||||
|
||||
+106
-11
@@ -346,6 +346,53 @@ function setRacePrologueRemaining(remainingMs) {
|
||||
setRacePrologue(setPrologueRemaining(racePrologue, remainingMs));
|
||||
renderView();
|
||||
}
|
||||
// --- Race Day as the place where things are run --------------------------------------
|
||||
// "New practice day": clears the session's laps on Timing for a new day; every lap so far
|
||||
// is first put in the training stats, where resultsResetAt keeps it (see syncTrainingLedger).
|
||||
function resetSessionData(session) {
|
||||
if (!session) return false;
|
||||
syncTrainingLedger();
|
||||
session.resultsResetAt = Date.now();
|
||||
delete state.resultsBySession[session.id];
|
||||
session.followUpStartedAt = null;
|
||||
lastFinishAnnouncementSessionId = null;
|
||||
delete lastOverlayLeaderKeyBySession[session.id];
|
||||
delete lastOverlayTop3BySession[session.id];
|
||||
overlayEvents = [];
|
||||
saveState();
|
||||
renderView();
|
||||
return true;
|
||||
}
|
||||
|
||||
// The Open Practice "Start practice" works on: one already running, else a paused one,
|
||||
// else the latest not-finished one (a club often runs one all season); null = make a new one.
|
||||
function findOpenPracticeToContinue() {
|
||||
const practices = state.sessions.filter((session) => session.type === "open_practice");
|
||||
const latest = (list) => list.sort((a, b) => Number(b.startedAt || 0) - Number(a.startedAt || 0))[0] || null;
|
||||
return latest(practices.filter((session) => session.status === "running"))
|
||||
|| latest(practices.filter((session) => session.status === "paused"))
|
||||
|| practices.filter((session) => session.status === "ready").at(-1)
|
||||
|| null;
|
||||
}
|
||||
|
||||
// One click from Race Day: continue the Open Practice, or create and start one for today.
|
||||
async function startPracticeNow() {
|
||||
let session = findOpenPracticeToContinue();
|
||||
if (!session) {
|
||||
const bundle = buildOpenPracticeBundle({ name: t("events.quick_open_practice_default"), date: new Date().toISOString().slice(0, 10) });
|
||||
state.events.push(bundle.event);
|
||||
state.sessions.push(bundle.session);
|
||||
session = bundle.session;
|
||||
}
|
||||
selectOperationalSession(session.id, { render: false });
|
||||
if (session.status === "paused") return resumeOperationalSession(session);
|
||||
if (session.status === "running") { renderView(); return true; }
|
||||
const result = await startOperationalSession(session);
|
||||
if (!result.ok && result.message) alert(result.message);
|
||||
renderView();
|
||||
return result.ok;
|
||||
}
|
||||
|
||||
function goRacePrologue() {
|
||||
const session = getPrologueSession();
|
||||
setRacePrologue(null);
|
||||
@@ -405,7 +452,7 @@ const processDecoderMessage = (msg, decoderRole = "main") => processDecoderMessa
|
||||
getTrackRecordMs,
|
||||
onTransponderSeen,
|
||||
}, decoderRole);
|
||||
const renderDashboard = () => renderDashboardView({ addTrackLayout, state, dom, t, backend, getActiveSession, getStatusLabel, getSessionTypeLabel, getEventName, getModeLabel, getBackendUrl, formatLap, renderSessionsTable, setCurrentView: (view) => { currentView = view; }, updateViewUrl, renderNav, renderView, connectDecoder, disconnectDecoder, openOverlayWindow, ensureAudioContext, playPassingBeep, playFinishSiren, escapeHtml });
|
||||
const renderDashboard = () => renderDashboardView({ addTrackLayout, startPracticeNow, state, dom, t, backend, getActiveSession, getStatusLabel, getSessionTypeLabel, getEventName, getModeLabel, getBackendUrl, formatLap, renderSessionsTable, setCurrentView: (view) => { currentView = view; }, updateViewUrl, renderNav, renderView, connectDecoder, disconnectDecoder, openOverlayWindow, ensureAudioContext, playPassingBeep, playFinishSiren, escapeHtml });
|
||||
const renderClasses = () => renderClassesView({ state, dom, t, selectedClassEditId: () => selectedClassEditId, setSelectedClassEditId: (value) => { selectedClassEditId = value; }, uid, saveState, renderView, renderTable, escapeHtml, setFormError, bindModalShell });
|
||||
// Driver page "Test pronunciation": the passing sound, then two real announcements with the
|
||||
// spoken name, through race audio (so the chosen voice / Piper is what you hear).
|
||||
@@ -424,6 +471,7 @@ const renderRaceDay = () => renderRaceDayView({
|
||||
getRaceDayWarmupCheck, setDriverTransponder, getDefaultPrologueSec,
|
||||
startRacePrologue, holdRacePrologue, resumeRacePrologue, setRacePrologueRemaining, cancelRacePrologue, goRacePrologue,
|
||||
isStartPending: (session) => Boolean(session && pendingStartSessionId === session.id),
|
||||
resetSessionData, startPracticeNow, findOpenPracticeToContinue,
|
||||
getLiveSession,
|
||||
renderSuspectLapsPanel: (session) => renderSuspectLapsPanelView(session, { t, escapeHtml, formatLap, ensureSessionResult }),
|
||||
setCompetitorLapStatus,
|
||||
@@ -483,7 +531,7 @@ const refreshTimingDynamics = () => {
|
||||
node.textContent = clock;
|
||||
});
|
||||
};
|
||||
const renderTiming = () => renderTimingView({ 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), openJudging: (rowKey) => { selectedJudgeKey = rowKey; selectedLeaderboardKey = null; navigateToView("judging"); } });
|
||||
const renderTiming = () => renderTimingView({ 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 normalizeTrainingState = (training) => normalizeTrainingStateLogic(training, { uid });
|
||||
const syncTrainingLedger = () => {
|
||||
@@ -799,6 +847,29 @@ const TRANSLATIONS = {
|
||||
"series.step3": "3 · Deltävlingar ({count})",
|
||||
"series.step4": "4 · Ställning",
|
||||
"series.classes_all": "Alla",
|
||||
"dashboard.quick_title": "Vanliga uppgifter",
|
||||
"dashboard.quick_practice": "Starta träning",
|
||||
"dashboard.quick_practice_hint": "Fortsätter pågående Open Practice eller startar en ny - direkt till Race Day.",
|
||||
"dashboard.quick_race": "Skapa race",
|
||||
"dashboard.quick_race_hint": "Kval och finaler för en tävling.",
|
||||
"dashboard.quick_series": "Skapa serie",
|
||||
"dashboard.quick_series_hint": "Flera deltävlingar med poäng och ställning.",
|
||||
"timing.run_on_race_day": "Starta, pausa, avsluta och ny träningsdag görs på Race Day.",
|
||||
"timing.open_race_day": "Gå till Race Day",
|
||||
"race_day.quick_title": "Snabbval",
|
||||
"race_day.start_practice": "Starta träning",
|
||||
"race_day.pause_practice": "Pausa",
|
||||
"race_day.resume_practice": "Fortsätt",
|
||||
"race_day.finish_practice": "Avsluta träning",
|
||||
"race_day.quick_practice_new": "Starta träning",
|
||||
"race_day.quick_practice_continue": "Fortsätt träning: {name}",
|
||||
"race_day.quick_practice_show": "Pågående träning: {name}",
|
||||
"race_day.quick_layout": "Ny banlayout",
|
||||
"race_day.quick_race": "Skapa race",
|
||||
"race_day.pick_session": "Session",
|
||||
"race_day.new_practice_day": "Ny träningsdag",
|
||||
"race_day.new_practice_day_hint": "Nollställer dagens varv i tidtagningen. Alla varv finns kvar i träningsstatistiken.",
|
||||
"race_day.new_practice_day_confirm": "Starta en ny träningsdag i \"{name}\"?\n\nDagens varv nollställs i tidtagningen (topplistan börjar om). Alla varv finns kvar i träningsstatistiken.",
|
||||
"timing.live_elsewhere": "Varv registreras just nu på \"{name}\", som pågår - inte på den valda sessionen.",
|
||||
"timing.show_live": "Visa den",
|
||||
"overlay.obs_show_position_change": "Placering sedan start (▲/▼) i race",
|
||||
@@ -1287,7 +1358,7 @@ const TRANSLATIONS = {
|
||||
"dashboard.behind": "Efter schema",
|
||||
"dashboard.live_note": "Snabb driftpanel för anslutning, overlay och ljud. Djupare konfig ligger kvar under Inställningar.",
|
||||
"dashboard.get_started": "Kom igång",
|
||||
"dashboard.get_started_hint": "Följ arbetsordningen första gången. Vid vanlig träning kan du gå direkt till Open Practice.",
|
||||
"dashboard.get_started_hint": "Följ arbetsordningen första gången. För en vanlig träningskväll räcker knappen Starta träning ovan.",
|
||||
"dashboard.step_system": "1. Anslut systemet",
|
||||
"dashboard.step_system_hint": "Konfigurera backend, decoder och AMMC i Inställningar.",
|
||||
"dashboard.step_register": "2. Lägg in register",
|
||||
@@ -1295,7 +1366,7 @@ const TRANSLATIONS = {
|
||||
"dashboard.step_create": "3. Skapa körning",
|
||||
"dashboard.step_create_hint": "Starta enkel Open Practice eller bygg klubbrace, endurance och sponsor-event.",
|
||||
"dashboard.step_run": "4. Kör och visa",
|
||||
"dashboard.step_run_hint": "Starta sessionen i Tidtagning och öppna Overlay på extern skärm.",
|
||||
"dashboard.step_run_hint": "Starta, pausa och avsluta på Race Day. Följ tiderna i Tidtagning och öppna Overlay på en extern skärm.",
|
||||
"dashboard.open_settings": "Öppna Inställningar",
|
||||
"dashboard.open_register": "Öppna Förare",
|
||||
"dashboard.open_race_setup": "Open Practice / Race Setup",
|
||||
@@ -2305,7 +2376,7 @@ const TRANSLATIONS = {
|
||||
"guide.sponsor_3": "3. Skapa event med läge Sponsor Event.",
|
||||
"guide.sponsor_4": "4. Klicka Hantera på eventet och skapa rundor (kval/heat/final).",
|
||||
"guide.sponsor_5": "5. Tilldela 4 förare till 4 bilar i Heat 1, byt förare till Heat 2/3 osv.",
|
||||
"guide.sponsor_6": "6. I Tidtagning: välj session, Sätt aktiv, Starta, Stoppa.",
|
||||
"guide.sponsor_6": "6. På Race Day: välj session och tryck Start, Pausa och Avsluta. Tidtagning visar tiderna.",
|
||||
"guide.race_title": "Skapa vanligt race (förare har egna transpondrar)",
|
||||
"guide.race_1": "1. Lägg in förare med personlig transponder. Brandfältet kan användas för team, sponsor eller bilmärke.",
|
||||
"guide.race_2": "2. Skapa event med läge Race.",
|
||||
@@ -2344,7 +2415,7 @@ const TRANSLATIONS = {
|
||||
"guide.open_practice_2": "Om transpondern inte matchar en registrerad förare visas transpondernumret som namn.",
|
||||
"guide.open_practice_3": "Open Practice påverkar inte seedning, kval eller finaler.",
|
||||
"guide.open_practice_4": "Gå till Race Setup och använd Snabbstart Open Practice. Du behöver bara ange ett namn; klass, deltagare, preset och racetid behövs inte.",
|
||||
"guide.open_practice_5": "Efter skapandet öppnas Tidtagning direkt. Klicka Starta och låt sessionen gå tills du själv stoppar den.",
|
||||
"guide.open_practice_5": "Enklast: tryck Starta träning på Översikten eller Race Day - då fortsätter en pågående Open Practice eller så skapas och startas en ny. Ny träningsdag på Race Day nollställer dagens varv utan att statistiken försvinner, och Ny banlayout finns bland snabbvalen.",
|
||||
"guide.team_title": "Lagrace / Endurance",
|
||||
"guide.team_1": "Gå till Race Setup och skapa ett race i rätt klass.",
|
||||
"guide.team_2": "Öppna Hantera och gå till sektionen Lag.",
|
||||
@@ -2607,6 +2678,29 @@ const TRANSLATIONS = {
|
||||
"series.step3": "3 · Rounds ({count})",
|
||||
"series.step4": "4 · Standings",
|
||||
"series.classes_all": "All",
|
||||
"dashboard.quick_title": "Common tasks",
|
||||
"dashboard.quick_practice": "Start practice",
|
||||
"dashboard.quick_practice_hint": "Continues the running Open Practice or starts a new one - straight to Race Day.",
|
||||
"dashboard.quick_race": "Create race",
|
||||
"dashboard.quick_race_hint": "Qualifying and finals for one event.",
|
||||
"dashboard.quick_series": "Create series",
|
||||
"dashboard.quick_series_hint": "Several rounds with points and standings.",
|
||||
"timing.run_on_race_day": "Start, pause, finish and new practice day are done on Race Day.",
|
||||
"timing.open_race_day": "Go to Race Day",
|
||||
"race_day.quick_title": "Quick actions",
|
||||
"race_day.start_practice": "Start practice",
|
||||
"race_day.pause_practice": "Pause",
|
||||
"race_day.resume_practice": "Resume",
|
||||
"race_day.finish_practice": "Finish practice",
|
||||
"race_day.quick_practice_new": "Start practice",
|
||||
"race_day.quick_practice_continue": "Continue practice: {name}",
|
||||
"race_day.quick_practice_show": "Practice running: {name}",
|
||||
"race_day.quick_layout": "New track layout",
|
||||
"race_day.quick_race": "Create race",
|
||||
"race_day.pick_session": "Session",
|
||||
"race_day.new_practice_day": "New practice day",
|
||||
"race_day.new_practice_day_hint": "Clears today's laps in timing. Every lap stays in the training statistics.",
|
||||
"race_day.new_practice_day_confirm": "Start a new practice day in \"{name}\"?\n\nToday's laps are cleared in timing (the leaderboard starts over). Every lap stays in the training statistics.",
|
||||
"timing.live_elsewhere": "Laps are being recorded on \"{name}\", which is running - not on the selected session.",
|
||||
"timing.show_live": "Show it",
|
||||
"overlay.obs_show_position_change": "Places since the start (▲/▼) in races",
|
||||
@@ -3095,7 +3189,7 @@ const TRANSLATIONS = {
|
||||
"dashboard.behind": "Behind schedule",
|
||||
"dashboard.live_note": "Quick operations panel for connection, overlay and audio. Deeper configuration remains under Settings.",
|
||||
"dashboard.get_started": "Getting started",
|
||||
"dashboard.get_started_hint": "Follow this order for initial setup. For normal practice, go directly to Open Practice.",
|
||||
"dashboard.get_started_hint": "Follow this order for initial setup. For a normal practice evening, the Start practice button above is all you need.",
|
||||
"dashboard.step_system": "1. Connect the system",
|
||||
"dashboard.step_system_hint": "Configure backend, decoder and AMMC in Settings.",
|
||||
"dashboard.step_register": "2. Build the directory",
|
||||
@@ -3103,7 +3197,7 @@ const TRANSLATIONS = {
|
||||
"dashboard.step_create": "3. Create a run",
|
||||
"dashboard.step_create_hint": "Start a simple Open Practice or build club races, endurance and sponsor events.",
|
||||
"dashboard.step_run": "4. Run and display",
|
||||
"dashboard.step_run_hint": "Start the session in Timing and open Overlay on an external display.",
|
||||
"dashboard.step_run_hint": "Start, pause and finish on Race Day. Follow the times in Timing and open Overlay on an external display.",
|
||||
"dashboard.open_settings": "Open Settings",
|
||||
"dashboard.open_register": "Open Drivers",
|
||||
"dashboard.open_race_setup": "Open Practice / Race Setup",
|
||||
@@ -4113,7 +4207,7 @@ const TRANSLATIONS = {
|
||||
"guide.sponsor_3": "3. Create event in Track Event mode.",
|
||||
"guide.sponsor_4": "4. Click Manage and create rounds (qualification/heat/final).",
|
||||
"guide.sponsor_5": "5. Assign 4 drivers to 4 cars in Heat 1, rotate drivers for Heat 2/3, then finals.",
|
||||
"guide.sponsor_6": "6. In Timing: select session, Set Active, Start, Stop.",
|
||||
"guide.sponsor_6": "6. On Race Day: pick the session and press Start, Pause and Finish. Timing shows the times.",
|
||||
"guide.race_title": "Create regular race (driver transponders)",
|
||||
"guide.race_1": "1. Add drivers with personal transponder IDs. The brand field can be used for team, sponsor or car brand.",
|
||||
"guide.race_2": "2. Create event in Race mode.",
|
||||
@@ -4152,7 +4246,7 @@ const TRANSLATIONS = {
|
||||
"guide.open_practice_2": "If the transponder does not match a registered driver, the transponder number is shown as the name.",
|
||||
"guide.open_practice_3": "Open Practice does not affect seeding, qualifying or finals.",
|
||||
"guide.open_practice_4": "Go to Race Setup and use Quick Open Practice. Only a name is required; class, participants, preset and race duration are not needed.",
|
||||
"guide.open_practice_5": "Timing opens directly after creation. Click Start and let the session run until you stop it yourself.",
|
||||
"guide.open_practice_5": "Easiest: press Start practice on the Dashboard or Race Day - it continues a running Open Practice or creates and starts a new one. New practice day on Race Day clears the day's laps without losing statistics, and New track layout is among the quick actions.",
|
||||
"guide.team_title": "Team Race / Endurance",
|
||||
"guide.team_1": "Go to Race Setup and create a race in the correct class.",
|
||||
"guide.team_2": "Open Manage and go to the Teams section.",
|
||||
@@ -6013,10 +6107,11 @@ function renderEventWorkspace(mode) {
|
||||
isValidIsoDate,
|
||||
saveState,
|
||||
purgeSessionPassings,
|
||||
// Opens the session where it is run: Race Day (start/pause/finish moved there from Timing).
|
||||
openTimingSession: (sessionId) => {
|
||||
state.activeSessionId = sessionId;
|
||||
saveState();
|
||||
currentView = "timing";
|
||||
currentView = "race_day";
|
||||
updateViewUrl(currentView);
|
||||
renderNav();
|
||||
updateHeaderState();
|
||||
|
||||
@@ -66,6 +66,7 @@ export function renderDashboardView(deps) {
|
||||
playFinishSiren,
|
||||
escapeHtml,
|
||||
addTrackLayout,
|
||||
startPracticeNow = async () => false,
|
||||
} = deps;
|
||||
|
||||
const active = getActiveSession();
|
||||
@@ -78,6 +79,11 @@ export function renderDashboardView(deps) {
|
||||
|
||||
dom.view.innerHTML = `
|
||||
${renderTrackLayoutBar({ state, t, escapeHtml, showNewButton: !active || isPracticeSessionType(active.type) })}
|
||||
<section class="dashboard-quick mt-16" aria-label="${escapeHtml(t("dashboard.quick_title"))}">
|
||||
<button class="btn btn-primary dashboard-quick-btn" type="button" id="dashboardQuickPractice"><strong>▶ ${t("dashboard.quick_practice")}</strong><small>${t("dashboard.quick_practice_hint")}</small></button>
|
||||
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickRace"><strong>🏁 ${t("dashboard.quick_race")}</strong><small>${t("dashboard.quick_race_hint")}</small></button>
|
||||
<button class="btn dashboard-quick-btn" type="button" id="dashboardQuickSeries"><strong>🏆 ${t("dashboard.quick_series")}</strong><small>${t("dashboard.quick_series_hint")}</small></button>
|
||||
</section>
|
||||
<section class="panel dashboard-workflow mt-16">
|
||||
<div class="panel-header">
|
||||
<div>
|
||||
@@ -210,6 +216,13 @@ export function renderDashboardView(deps) {
|
||||
document.getElementById("workflowDrivers")?.addEventListener("click", () => navigateTo("drivers"));
|
||||
document.getElementById("workflowRaceSetup")?.addEventListener("click", () => navigateTo("race_setup"));
|
||||
document.getElementById("workflowRaceDay")?.addEventListener("click", () => navigateTo("race_day"));
|
||||
// The three things a club evening usually starts with.
|
||||
document.getElementById("dashboardQuickPractice")?.addEventListener("click", async () => {
|
||||
navigateTo("race_day");
|
||||
await startPracticeNow();
|
||||
});
|
||||
document.getElementById("dashboardQuickRace")?.addEventListener("click", () => navigateTo("race_setup"));
|
||||
document.getElementById("dashboardQuickSeries")?.addEventListener("click", () => navigateTo("series"));
|
||||
document.getElementById("workflowTiming")?.addEventListener("click", () => navigateTo("timing"));
|
||||
document.getElementById("workflowOverlay")?.addEventListener("click", () => navigateTo("overlay"));
|
||||
|
||||
|
||||
+43
-7
@@ -175,6 +175,7 @@ export function renderRaceDayView(deps) {
|
||||
getRaceDayWarmupCheck, setDriverTransponder, getDefaultPrologueSec,
|
||||
startRacePrologue, holdRacePrologue, resumeRacePrologue, setRacePrologueRemaining, cancelRacePrologue, goRacePrologue,
|
||||
isStartPending, renderSuspectLapsPanel = () => "", setCompetitorLapStatus = () => false, getLiveSession = () => null,
|
||||
resetSessionData = () => false, startPracticeNow = async () => false, findOpenPracticeToContinue = () => null,
|
||||
} = deps;
|
||||
const queue = buildRaceDayQueue(state);
|
||||
const session = queue.current;
|
||||
@@ -200,14 +201,32 @@ export function renderRaceDayView(deps) {
|
||||
// Another session is running while a different one is selected: say where laps go.
|
||||
const liveSession = getLiveSession();
|
||||
const liveElsewhere = liveSession && session && liveSession.id !== session.id && ["running", "paused"].includes(liveSession.status) ? liveSession : null;
|
||||
// Quick actions for the common club evening, so nobody has to know where things live.
|
||||
const practice = findOpenPracticeToContinue();
|
||||
const practiceLabel = !practice ? t("race_day.quick_practice_new")
|
||||
: practice.status === "running" ? t("race_day.quick_practice_show", { name: practice.name })
|
||||
: t("race_day.quick_practice_continue", { name: practice.name });
|
||||
const sessionChoices = state.sessions.slice().sort((a, b) => {
|
||||
const rank = (item) => (["running", "paused"].includes(item.status) ? 0 : item.status === "ready" ? 1 : 2);
|
||||
return rank(a) - rank(b) || Number(b.startedAt || 0) - Number(a.startedAt || 0);
|
||||
});
|
||||
const isPracticeSession = Boolean(session && (isPracticeSessionType(session.type) || session.type === "practice"));
|
||||
const isLiveSession = ["running", "paused"].includes(session?.status);
|
||||
// Layouts are a practice thing: never offered while a race session is in focus.
|
||||
const layoutAllowed = !session || isPracticeSessionType(session.type);
|
||||
dom.view.innerHTML = `
|
||||
<section class="race-day-quick" aria-label="${escapeHtml(t("race_day.quick_title"))}">
|
||||
<button class="btn btn-primary race-day-quick-btn" type="button" id="raceDayQuickPractice">▶ ${escapeHtml(practiceLabel)}</button>
|
||||
${layoutAllowed ? `<button class="btn race-day-quick-btn" type="button" data-track-layout-new>🧱 ${escapeHtml(t("race_day.quick_layout"))}</button>` : ""}
|
||||
<button class="btn race-day-quick-btn" type="button" id="raceDayQuickRace">🏁 ${escapeHtml(t("race_day.quick_race"))}</button>
|
||||
</section>
|
||||
${liveElsewhere ? `<div class="live-elsewhere-banner" id="liveElsewhereBanner"><span>⏱ ${escapeHtml(t("timing.live_elsewhere", { name: liveElsewhere.name }))}</span><button class="btn btn-mini" type="button" data-show-live="${escapeHtml(liveElsewhere.id)}">${escapeHtml(t("timing.show_live"))}</button></div>` : ""}
|
||||
<section class="race-day-hero ${preflight.ready ? "is-ready" : "has-blockers"}">
|
||||
<div>
|
||||
<span class="race-day-kicker">${t("race_day.current")}</span>
|
||||
<h2>${session ? escapeHtml(session.name) : t("race_day.no_session")}</h2>
|
||||
<p>${session ? `${escapeHtml(getEventName(session.eventId))} · ${escapeHtml(getSessionTypeLabel(session.type))} · ${escapeHtml(getStartModeLabel(session.startMode))}` : t("race_day.no_session_hint")}</p>
|
||||
${renderTrackLayoutBar({ state, t, escapeHtml, showNewButton: !session || isPracticeSessionType(session.type) })}
|
||||
${renderTrackLayoutBar({ state, t, escapeHtml, showNewButton: false })}
|
||||
</div>
|
||||
${prologue
|
||||
? `<div class="race-day-clock is-prologue"><strong data-prologue-clock>${formatMmSs(warmupForChecks.remainingMs)}</strong><span>${t("prologue.to_start")}</span></div>`
|
||||
@@ -222,20 +241,28 @@ export function renderRaceDayView(deps) {
|
||||
<span class="pill ${preflight.ready ? "pill-green" : "pill-red"}">${t(preflight.ready ? "race_day.ready" : "race_day.not_ready")}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<label class="race-day-session-picker"><span>${t("race_day.pick_session")}</span>
|
||||
<select id="raceDaySessionSelect">
|
||||
${session ? "" : `<option value="">${t("race_day.none")}</option>`}
|
||||
${sessionChoices.map((item) => `<option value="${escapeHtml(item.id)}" ${session?.id === item.id ? "selected" : ""}>${escapeHtml(`${item.name} · ${getEventName(item.eventId)} · ${getStatusLabel(item.status)}`)}</option>`).join("")}
|
||||
</select>
|
||||
</label>
|
||||
${session && !isSelected ? `<button id="raceDayActivate" class="btn" type="button">${t("race_day.activate")}</button>` : ""}
|
||||
<div class="race-day-actions">
|
||||
${usesPrologue
|
||||
? renderPrologueControls({ t, escapeHtml, getDefaultPrologueSec }, session, warmupForChecks, canStart)
|
||||
: `<button id="raceDayStart" class="btn btn-primary" type="button" ${canStart ? "" : "disabled"}>${t("timing.start")}</button>`}
|
||||
: isLiveSession ? "" : `<button id="raceDayStart" class="btn btn-primary" type="button" ${canStart ? "" : "disabled"}>${t(isPracticeSession ? "race_day.start_practice" : "timing.start")}</button>`}
|
||||
${prologue ? "" : `
|
||||
<button id="raceDayPause" class="btn" type="button" ${session?.status === "running" ? "" : "disabled"}>${t("audio.race_pause")}</button>
|
||||
<button id="raceDayResume" class="btn" type="button" ${session?.status === "paused" ? "" : "disabled"}>${t("audio.race_resume")}</button>
|
||||
<button id="raceDayFinish" class="btn btn-danger" type="button" ${["running", "paused"].includes(session?.status) ? "" : "disabled"}>${t("race_day.finish")}</button>`}
|
||||
<!-- Practice gets plain words; a race keeps race wording. Only the buttons that apply are shown. -->
|
||||
${session?.status === "running" ? `<button id="raceDayPause" class="btn" type="button">${t(isPracticeSession ? "race_day.pause_practice" : "audio.race_pause")}</button>` : ""}
|
||||
${session?.status === "paused" ? `<button id="raceDayResume" class="btn btn-primary" type="button">${t(isPracticeSession ? "race_day.resume_practice" : "audio.race_resume")}</button>` : ""}
|
||||
${isLiveSession ? `<button id="raceDayFinish" class="btn btn-danger" type="button">${t(isPracticeSession ? "race_day.finish_practice" : "race_day.finish")}</button>` : ""}
|
||||
${isPracticeSession ? `<button id="raceDayNewPracticeDay" class="btn" type="button" title="${escapeHtml(t("race_day.new_practice_day_hint"))}">${t("race_day.new_practice_day")}</button>` : ""}`}
|
||||
</div>
|
||||
<div id="raceDayStartLights" class="race-start-lights" data-state="${escapeHtml(getStartLightState())}">
|
||||
${isPracticeSession ? "" : `<div id="raceDayStartLights" class="race-start-lights" data-state="${escapeHtml(getStartLightState())}">
|
||||
${[1, 2, 3, 4, 5].map((light) => `<span data-start-light="${light}"></span>`).join("")}
|
||||
<strong>${escapeHtml(getStartLightState())}</strong>
|
||||
</div>
|
||||
</div>`}
|
||||
<div class="race-day-shortcuts">
|
||||
<button id="raceDayTiming" class="btn btn-mini" type="button">${t("nav.timing")}</button>
|
||||
<button id="raceDayOverlay" class="btn btn-mini" type="button">${t("nav.overlay")}</button>
|
||||
@@ -339,6 +366,15 @@ export function renderRaceDayView(deps) {
|
||||
if (!result.ok && button) button.disabled = false;
|
||||
});
|
||||
dom.view.querySelector("[data-show-live]")?.addEventListener("click", (event) => selectSession(event.currentTarget.dataset.showLive));
|
||||
document.getElementById("raceDayQuickPractice")?.addEventListener("click", (event) => {
|
||||
event.currentTarget.disabled = true;
|
||||
startPracticeNow();
|
||||
});
|
||||
document.getElementById("raceDayQuickRace")?.addEventListener("click", () => navigateTo("race_setup"));
|
||||
document.getElementById("raceDaySessionSelect")?.addEventListener("change", (event) => { if (event.target.value) selectSession(event.target.value); });
|
||||
document.getElementById("raceDayNewPracticeDay")?.addEventListener("click", () => {
|
||||
if (session && window.confirm(t("race_day.new_practice_day_confirm", { name: session.name }))) resetSessionData(session);
|
||||
});
|
||||
dom.view.querySelectorAll("[data-lap-action]").forEach((button) => button.addEventListener("click", () => {
|
||||
if (session && setCompetitorLapStatus(session, button.dataset.lapRow, Number(button.dataset.lapTs), button.dataset.lapAction)) renderView();
|
||||
}));
|
||||
|
||||
@@ -4634,3 +4634,15 @@ tr.is-removed td.lap-actions {
|
||||
|
||||
/* Laps are going to a running session other than the selected one */
|
||||
.live-elsewhere-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; border: 1px solid #f5a623; border-radius: 10px; background: color-mix(in srgb, #f5a623 14%, transparent); font-weight: 600; }
|
||||
|
||||
/* Race Day quick actions and session picker */
|
||||
.race-day-quick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
|
||||
.race-day-quick-btn { font-size: 1rem; padding: 12px 18px; min-height: 48px; }
|
||||
.race-day-session-picker { display: grid; gap: 4px; margin-bottom: 12px; max-width: 520px; }
|
||||
.timing-run-on-race-day { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
|
||||
|
||||
/* Dashboard: the three common tasks */
|
||||
.dashboard-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
|
||||
.dashboard-quick-btn { display: grid; gap: 4px; text-align: left; padding: 16px 18px; min-height: 76px; }
|
||||
.dashboard-quick-btn strong { font-size: 1.05rem; }
|
||||
.dashboard-quick-btn small { font-weight: 400; opacity: 0.85; white-space: normal; }
|
||||
+4
-61
@@ -411,7 +411,7 @@ export function renderTimingView(deps) {
|
||||
getManualCorrectionSummary, formatTeamActiveMemberLabel, formatRaceClock, renderSessionChannelAnalysis,
|
||||
setLastFinishAnnouncementSessionId, lastOverlayLeaderKeyBySession, lastOverlayTop3BySession, overlayEvents, setOverlayEvents, sessionReplay,
|
||||
syncTrainingLedger = () => {}, setCompetitorLapStatus = () => false, openJudging = () => {},
|
||||
getLiveSession = () => null, selectLiveSession = () => {},
|
||||
getLiveSession = () => null, selectLiveSession = () => {}, openRaceDay = () => {},
|
||||
} = deps;
|
||||
|
||||
const helperDeps = {
|
||||
@@ -502,14 +502,9 @@ export function renderTimingView(deps) {
|
||||
</select>
|
||||
<div class="actions">
|
||||
<button id="setActiveSession" class="btn">${t("timing.set_active")}</button>
|
||||
<button id="startSession" class="btn btn-primary">${t("timing.start")}</button>
|
||||
<button id="stopSession" class="btn">${t("timing.stop")}</button>
|
||||
<button id="resetSession" class="btn btn-danger">${t("timing.reset")}</button>
|
||||
</div>
|
||||
<div id="raceStartLights" class="race-start-lights" data-state="${escapeHtml(getStartLightState())}">
|
||||
${[1, 2, 3, 4, 5].map((light) => `<span data-start-light="${light}"></span>`).join("")}
|
||||
<strong>${escapeHtml(getStartLightState())}</strong>
|
||||
</div>
|
||||
<!-- Start, pause, finish and "new practice day" live on Race Day; Timing is for following. -->
|
||||
<p class="hint timing-run-on-race-day">${t("timing.run_on_race_day")} <button id="timingOpenRaceDay" class="btn btn-mini" type="button">${t("timing.open_race_day")}</button></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body timing-session-summary">
|
||||
@@ -755,35 +750,7 @@ export function renderTimingView(deps) {
|
||||
renderView();
|
||||
});
|
||||
|
||||
document.getElementById("startSession")?.addEventListener("click", async () => {
|
||||
const session = getActiveSession();
|
||||
const startButton = document.getElementById("startSession");
|
||||
if (!session || startButton?.disabled) return;
|
||||
if (startButton) startButton.disabled = true;
|
||||
const updateStartDisplay = (label, lights = 0) => {
|
||||
if (startButton && label) startButton.textContent = label;
|
||||
const panel = document.getElementById("raceStartLights");
|
||||
if (!panel) return;
|
||||
panel.dataset.state = label;
|
||||
panel.querySelector("strong")?.replaceChildren(document.createTextNode(label));
|
||||
panel.querySelectorAll("[data-start-light]").forEach((node) => node.classList.toggle("is-on", Number(node.dataset.startLight) <= lights));
|
||||
};
|
||||
const result = await startOperationalSession(session, {
|
||||
onCountdown: (seconds) => updateStartDisplay(String(seconds), 0),
|
||||
onLight: (light) => updateStartDisplay("LIGHT_" + light, light),
|
||||
onArmed: () => updateStartDisplay("WAIT_RANDOM", 5),
|
||||
});
|
||||
if (!result.ok) {
|
||||
if (result.message) alert(result.message);
|
||||
if (startButton) startButton.disabled = false;
|
||||
updateStartDisplay(t("timing.start"), 0);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("stopSession")?.addEventListener("click", () => {
|
||||
const session = getActiveSession();
|
||||
if (session) finishOperationalSession(session);
|
||||
});
|
||||
document.getElementById("timingOpenRaceDay")?.addEventListener("click", () => openRaceDay());
|
||||
|
||||
dom.view.querySelector("[data-show-live]")?.addEventListener("click", (event) => selectLiveSession(event.currentTarget.dataset.showLive));
|
||||
// Remove / restore / approve one lap - from the suspect panel or a driver's lap list.
|
||||
@@ -792,36 +759,12 @@ export function renderTimingView(deps) {
|
||||
if (session && setCompetitorLapStatus(session, button.dataset.lapRow, Number(button.dataset.lapTs), button.dataset.lapAction)) renderView();
|
||||
}));
|
||||
|
||||
document.getElementById("resetSession")?.addEventListener("click", () => {
|
||||
const session = getActiveSession();
|
||||
if (!session) {
|
||||
return;
|
||||
}
|
||||
if (!confirm(t("timing.clear_confirm"))) {
|
||||
return;
|
||||
}
|
||||
// Every lap so far goes into the training stats first; resultsResetAt then keeps them
|
||||
// there although they leave this session's results (see syncTrainingLedger).
|
||||
syncTrainingLedger();
|
||||
session.resultsResetAt = Date.now();
|
||||
delete state.resultsBySession[session.id];
|
||||
session.followUpStartedAt = null;
|
||||
setLastFinishAnnouncementSessionId(null);
|
||||
delete lastOverlayLeaderKeyBySession[session.id];
|
||||
delete lastOverlayTop3BySession[session.id];
|
||||
setOverlayEvents([]);
|
||||
saveState();
|
||||
renderView();
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-race-audio-cue]").forEach((node) => {
|
||||
node.addEventListener("click", () => {
|
||||
const cue = node.dataset.raceAudioCue;
|
||||
const session = getActiveSession();
|
||||
if (cue === "false_start") {
|
||||
cancelRaceStart();
|
||||
const startButton = document.getElementById("startSession");
|
||||
if (startButton) { startButton.disabled = false; startButton.textContent = t("timing.start"); }
|
||||
} else if (cue === "race_paused" && session?.status === "running") {
|
||||
session.status = "paused";
|
||||
session.pausedAt = Date.now();
|
||||
|
||||
@@ -30,7 +30,7 @@ export async function runCorrectionsScopeSmoke({ evaluate, navigate, savedState,
|
||||
|
||||
try {
|
||||
// Race: Timing details are read-only and point to Judging.
|
||||
await navigate("timing", "resetSession");
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
await evaluate(`document.getElementById("leaderboard-detail-driver_cs_driver").click()`);
|
||||
await waitFor(async () => exists("#corrOpenJudging"), "Open in Judging in a race");
|
||||
assert.equal(await exists("#corrLapPlus"), false, "no penalty buttons on Timing");
|
||||
@@ -43,7 +43,7 @@ export async function runCorrectionsScopeSmoke({ evaluate, navigate, savedState,
|
||||
|
||||
// Practice: no penalties anywhere, lap clean-up on Timing.
|
||||
await patchState({ sessions: (await savedState()).sessions.map((session) => (session.id === heat.id ? { ...session, status: "finished", endedAt: Date.now() } : session.id === practice.id ? { ...session, status: "running", startedAt } : session)), activeSessionId: practice.id });
|
||||
await navigate("timing", "resetSession");
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
await evaluate(`document.getElementById("leaderboard-detail-driver_cs_driver").click()`);
|
||||
await waitFor(async () => exists('#leaderboardModalOverlay [data-lap-action="remove"]'), "Remove per lap in practice");
|
||||
assert.equal(await exists("#corrOpenJudging"), false, "no corrections block in practice");
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function runLiveSessionSmoke({ evaluate, navigate, savedState, wait
|
||||
settings: { ...seeded.settings, autoReconnect: true, wsUrl: `ws://127.0.0.1:${decoder.port}` },
|
||||
});
|
||||
try {
|
||||
await navigate("timing", "resetSession");
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
await waitFor(async () => evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "decoder connected");
|
||||
await waitFor(async () => (await evaluate(`document.getElementById("liveElsewhereBanner")?.textContent || ""`)).includes("LS Practice A"), "the page says laps go to the running practice");
|
||||
decoder.sendPassing("8880001", startedAt + 20000);
|
||||
|
||||
@@ -37,15 +37,16 @@ export async function runPracticeResetSmoke({ evaluate, navigate, savedState, wa
|
||||
});
|
||||
|
||||
try {
|
||||
await navigate("timing", "resetSession");
|
||||
// "New practice day" lives on Race Day (it used to be "Reset data" on Timing).
|
||||
await navigate("race_day", "raceDayNewPracticeDay");
|
||||
// The laps were seeded straight into the results and haven't been synced into the training
|
||||
// stats yet - Reset itself must sync them before clearing (the case of laps driven since
|
||||
// the last save).
|
||||
const before = dialogs.length;
|
||||
await evaluate(`document.getElementById("resetSession").click()`);
|
||||
await evaluate(`document.getElementById("raceDayNewPracticeDay").click()`);
|
||||
await waitFor(async () => dialogs.slice(before).some((dialog) => dialog.type === "confirm" && /training|tränings/i.test(dialog.message)), "confirm says the laps stay in the training stats");
|
||||
// The Timing view recreates an empty result for the active session straight away - which
|
||||
// is why the old code lost the laps already on the next save, not only on the next lap.
|
||||
// A view can recreate an empty result for the active session straight away - which is why
|
||||
// the old code lost the laps already on the next save, not only on the next lap.
|
||||
await waitFor(async () => ((await savedState()).resultsBySession?.[practice.id]?.passings || []).length === 0, "timing data cleared");
|
||||
assert.deepEqual((await driverLaps()).sort(), [19000, 19500, 20000], "laps kept right after the reset");
|
||||
assert.equal((await savedState()).sessions.find((session) => session.id === practice.id).status, "running", "the practice keeps running");
|
||||
|
||||
@@ -13,6 +13,8 @@ export async function runRaceDaySmoke({ evaluate, navigate, fill, savedState, wa
|
||||
assert.equal(response.ok, true);
|
||||
};
|
||||
const buttonDisabled = async id => await evaluate(`document.getElementById(${JSON.stringify(id)})?.disabled`);
|
||||
// Race Day renders only the buttons that apply right now (no greyed-out Pause before a start).
|
||||
const shown = async id => await evaluate(`Boolean(document.getElementById(${JSON.stringify(id)}))`);
|
||||
|
||||
const decoder = await startFakeDecoder();
|
||||
try {
|
||||
@@ -46,8 +48,8 @@ export async function runRaceDaySmoke({ evaluate, navigate, fill, savedState, wa
|
||||
|
||||
await navigate("race_day", "raceDayStart");
|
||||
await waitFor(async () => (await buttonDisabled("raceDayStart")) === false, "start enabled once preflight is ready");
|
||||
assert.equal(await buttonDisabled("raceDayPause"), true);
|
||||
assert.equal(await buttonDisabled("raceDayFinish"), true);
|
||||
assert.equal(await shown("raceDayPause"), false, "no Pause before a start");
|
||||
assert.equal(await shown("raceDayFinish"), false, "no Finish before a start");
|
||||
|
||||
await click("raceDayStart");
|
||||
await waitFor(async () => (await findSession("Race Day Heat 1")).status === "running", "heat 1 running");
|
||||
@@ -56,15 +58,15 @@ export async function runRaceDaySmoke({ evaluate, navigate, fill, savedState, wa
|
||||
// normalizeSession() in src/app.js stores "not paused" as 0, not null (Number(null) === 0
|
||||
// passes its Number.isFinite check) - every real usage treats pausedAt as falsy, so match that.
|
||||
assert.ok(!started.pausedAt, "not paused after start");
|
||||
await waitFor(async () => (await buttonDisabled("raceDayPause")) === false, "pause enabled after start");
|
||||
await waitFor(async () => (await buttonDisabled("raceDayPause")) === false, "pause shown after start");
|
||||
assert.equal(await buttonDisabled("raceDayFinish"), false);
|
||||
assert.equal(await buttonDisabled("raceDayResume"), true);
|
||||
assert.equal(await shown("raceDayResume"), false, "no Resume while running");
|
||||
|
||||
await click("raceDayPause");
|
||||
await waitFor(async () => (await findSession("Race Day Heat 1")).status === "paused", "heat 1 paused");
|
||||
assert.ok((await findSession("Race Day Heat 1")).pausedAt, "pausedAt recorded");
|
||||
await waitFor(async () => (await buttonDisabled("raceDayResume")) === false, "resume enabled after pause");
|
||||
assert.equal(await buttonDisabled("raceDayPause"), true);
|
||||
await waitFor(async () => (await buttonDisabled("raceDayResume")) === false, "resume shown after pause");
|
||||
assert.equal(await shown("raceDayPause"), false, "no Pause while paused");
|
||||
await pause(1200);
|
||||
|
||||
await click("raceDayResume");
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
// The easy path for a club evening: the Dashboard's "Start practice" creates and starts an
|
||||
// Open Practice on Race Day; Race Day's quick actions add a track layout (the running practice
|
||||
// moves onto it) and switch sessions; Timing no longer has the run controls, only a link.
|
||||
export async function runRaceDayQuickSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs }) {
|
||||
// The layout prompts are expected here; drop them afterwards so later "no unexpected dialog" checks stay meaningful.
|
||||
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();
|
||||
// No Open Practice to continue, and nothing running: "Start practice" must create one.
|
||||
await patchState({
|
||||
sessions: seeded.sessions.map((session) => (session.type === "open_practice" || ["running", "paused"].includes(session.status) ? { ...session, status: "finished", endedAt: Date.now() } : session)),
|
||||
events: [...seeded.events, { id: "rq_event", name: "RQ Race", mode: "race", raceConfig: {} }],
|
||||
activeSessionId: "",
|
||||
trackLayouts: [],
|
||||
});
|
||||
const before = new Set((await savedState()).sessions.map((session) => session.id));
|
||||
let created = null;
|
||||
try {
|
||||
await navigate("dashboard", "dashboardQuickPractice");
|
||||
await evaluate(`document.getElementById("dashboardQuickPractice").click()`);
|
||||
await waitFor(async () => (await savedState()).sessions.some((session) => !before.has(session.id) && session.type === "open_practice" && session.status === "running"), "a new Open Practice is created and running");
|
||||
created = (await savedState()).sessions.find((session) => !before.has(session.id) && session.type === "open_practice");
|
||||
await waitFor(async () => (await savedState()).activeSessionId === created.id, "and selected");
|
||||
await waitFor(async () => (await evaluate(`location.search`)).includes("race_day") && Boolean(await evaluate(`document.getElementById("raceDayQuickPractice")`)), "on Race Day");
|
||||
await waitFor(async () => (await evaluate(`document.getElementById("raceDayQuickPractice").textContent`)).includes(created.name), "the quick button shows the running practice");
|
||||
assert.equal(await evaluate(`Boolean(document.getElementById("raceDayNewPracticeDay"))`), true, "New practice day is on Race Day for a practice");
|
||||
console.log("PASS Start practice on the Dashboard creates, starts and opens an Open Practice on Race Day");
|
||||
|
||||
await evaluate(`document.querySelector('.race-day-quick [data-track-layout-new]').click()`);
|
||||
await waitFor(async () => ((await savedState()).trackLayouts || []).length === 1, "a layout is created from the quick actions");
|
||||
const layoutId = (await savedState()).trackLayouts[0].id;
|
||||
await waitFor(async () => (await savedState()).sessions.find((session) => session.id === created.id)?.trackLayoutId === layoutId, "the running practice moved onto it");
|
||||
console.log("PASS New track layout from Race Day's quick actions moves the running practice onto it");
|
||||
|
||||
await patchState({ sessions: [...(await savedState()).sessions, { id: "rq_heat", eventId: "rq_event", name: "RQ Heat 1", type: "heat", status: "ready", durationMin: 5 }] });
|
||||
await navigate("race_day", "raceDaySessionSelect");
|
||||
await evaluate(`(() => { const select = document.getElementById("raceDaySessionSelect"); select.value = "rq_heat"; select.dispatchEvent(new Event("change")); })()`);
|
||||
await waitFor(async () => (await savedState()).activeSessionId === "rq_heat", "the session picker switches session");
|
||||
assert.equal(await evaluate(`Boolean(document.getElementById("raceDayNewPracticeDay"))`), false, "no New practice day for a heat");
|
||||
console.log("PASS Race Day's session picker switches the selected session");
|
||||
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
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 waitFor(async () => Boolean(await evaluate(`document.getElementById("raceDayQuickPractice")`)), "the link opens Race Day");
|
||||
console.log("PASS Timing is for following: run controls moved to Race Day, with a link there");
|
||||
} finally {
|
||||
dialogs.splice(dialogsAtStart);
|
||||
const current = await savedState();
|
||||
await patchState({
|
||||
sessions: current.sessions.filter((session) => session.id !== "rq_heat").map((session) => (created && session.id === created.id ? { ...session, status: "finished", endedAt: Date.now() } : session)),
|
||||
events: current.events.filter((event) => event.id !== "rq_event"),
|
||||
trackLayouts: [],
|
||||
activeSessionId: "",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { runSeriesSmoke } from "./browser_series.js";
|
||||
import { runTrainingSourceSmoke } from "./browser_training_source.js";
|
||||
import { runDecoderUrlSmoke } from "./browser_decoder_url.js";
|
||||
import { runLiveSessionSmoke } from "./browser_live_session.js";
|
||||
import { runRaceDayQuickSmoke } from "./browser_race_day_quick.js";
|
||||
import { runObsPopupSmoke } from "./browser_obs_popup.js";
|
||||
import { runDecoderReconnectSmoke } from "./browser_decoder_reconnect.js";
|
||||
import assert from "node:assert/strict";
|
||||
@@ -168,6 +169,7 @@ try {
|
||||
await runTrainingSourceSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runDecoderUrlSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runLiveSessionSmoke({ evaluate, navigate, savedState, waitFor, base });
|
||||
await runRaceDayQuickSmoke({ evaluate, navigate, savedState, waitFor, base, dialogs });
|
||||
await runRaceDaySmoke({ evaluate, navigate, fill, savedState, waitFor, pause, base, dialogs });
|
||||
await runRaceDayStartSequencesSmoke({ evaluate, navigate, waitFor, pause, base, dialogs });
|
||||
await runObsPopupSmoke({ evaluate, navigate, fill, savedState, waitFor, pause, base, debugPort, dialogs, realClick });
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function runSuspectLapsSmoke({ evaluate, navigate, savedState, wait
|
||||
});
|
||||
|
||||
try {
|
||||
await navigate("timing", "resetSession");
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
await waitFor(async () => evaluate('document.getElementById("connectionBadge")?.classList.contains("badge-online")'), "decoder connected");
|
||||
decoder.sendPassing("8330001", lastTs + 14000);
|
||||
await waitFor(async () => (await results())?.passings?.length === 7, "the short lap arrived");
|
||||
@@ -58,11 +58,11 @@ export async function runSuspectLapsSmoke({ evaluate, navigate, savedState, wait
|
||||
assert.equal(await evaluate(`[...document.querySelectorAll(".suspect-flag")].length > 0`), true, "⚠ in the overlay");
|
||||
console.log("PASS the overlay marks the driver with a suspect lap");
|
||||
|
||||
await navigate("race_day", "raceDayStart");
|
||||
await navigate("race_day", "raceDaySessionSelect");
|
||||
await waitFor(async () => Boolean(await evaluate(`document.querySelector('#suspectLapsPanel [data-lap-action="approve"]')`)), "the same panel on Race Day");
|
||||
console.log("PASS Race Day shows the suspect lap with Approve / Remove");
|
||||
|
||||
await navigate("timing", "resetSession");
|
||||
await navigate("timing", "activeSessionSelect");
|
||||
await waitFor(async () => Boolean(await evaluate(`document.querySelector('#suspectLapsPanel [data-lap-action="remove"]')`)), "Remove button");
|
||||
await evaluate(`document.querySelector('#suspectLapsPanel [data-lap-action="remove"]').click()`);
|
||||
await waitFor(async () => (await results())?.passings?.at(-1)?.validLap === false, "the short lap removed");
|
||||
|
||||
Reference in new issue
Block a user