diff --git a/CHANGELOG.md b/CHANGELOG.md index e70ce9f..a7dcb5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,15 @@ The application version is maintained in `package.json` and displayed in the adm No changes recorded yet. +## 1.70.2 + +### Fixed +- Team race: the length picked in Manage (e.g. 4 h) is kept before the team race is created; it fell back to 60 min. + +### Docs +- Video guides re-recorded for the current UI (Event Manager tab names updated). +- New video guides: sponsor event, team race, open practice ranking, race overview and archive, judging (calls, penalties, DSQ). Linked from the Guide and README. + ## 1.70.1 - Security: npm audit fix - proxy-addr 2.0.8 (critical: IP spoofing via IPv4-mapped IPv6), body-parser 2.4.0 (high: denial of service with a compressed body) and qs 6.17.1 (moderate). npm audit now reports 0 vulnerabilities. diff --git a/README.md b/README.md index 67f5bdc..9f3ee78 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,7 @@ Short narrated recordings (`.mkv`, H.264/AAC), also linked from the in-app Guide - **Getting started:** [Connect a decoder](docs/videos/connect-decoder.mkv) · [Add drivers and cars](docs/videos/add-drivers-cars.mkv) · [Create a race](docs/videos/create-race.mkv) · [Run a session](docs/videos/run-a-session.mkv) - **Interface tour:** [Settings tabs](docs/videos/settings-tabs.mkv) · [Event Manager tabs](docs/videos/event-manager-tabs.mkv) · [Race day schedule](docs/videos/event-schedule.mkv) +- **Race day and after:** [Sponsor event](docs/videos/sponsor-event.mkv) · [Team race](docs/videos/team-race.mkv) · [Open practice ranking](docs/videos/practice-ranking.mkv) · [Race overview and archive](docs/videos/race-overview.mkv) · [Judging: calls, penalties and DSQ](docs/videos/judging.mkv) Recorded with `node scripts/record-video-guides.mjs`, against an isolated test server. diff --git a/README.sv.md b/README.sv.md index 97dd6f8..b013e59 100644 --- a/README.sv.md +++ b/README.sv.md @@ -333,6 +333,7 @@ Korta inspelningar med berättarröst (`.mkv`, H.264/AAC), även länkade från - **Kom igång:** [Anslut en decoder](docs/videos/connect-decoder.mkv) · [Lägg till förare och bilar](docs/videos/add-drivers-cars.mkv) · [Skapa ett race](docs/videos/create-race.mkv) · [Kör en session](docs/videos/run-a-session.mkv) - **Rundtur i gränssnittet:** [Inställningsflikar](docs/videos/settings-tabs.mkv) · [Event Managers flikar](docs/videos/event-manager-tabs.mkv) · [Dagens schema](docs/videos/event-schedule.mkv) +- **Tävlingsdag och efteråt:** [Sponsorevent](docs/videos/sponsor-event.mkv) · [Lagrace](docs/videos/team-race.mkv) · [Ranking i öppen träning](docs/videos/practice-ranking.mkv) · [Race-översikt och arkiv](docs/videos/race-overview.mkv) · [Domare: utrop, straff och DSQ](docs/videos/judging.mkv) Spelas in med `node scripts/record-video-guides.mjs`, mot en isolerad testserver. diff --git a/docs/videos/add-drivers-cars.mkv b/docs/videos/add-drivers-cars.mkv index d3c1461..a08f6f8 100644 Binary files a/docs/videos/add-drivers-cars.mkv and b/docs/videos/add-drivers-cars.mkv differ diff --git a/docs/videos/connect-decoder.mkv b/docs/videos/connect-decoder.mkv index c1504b5..cfad641 100644 Binary files a/docs/videos/connect-decoder.mkv and b/docs/videos/connect-decoder.mkv differ diff --git a/docs/videos/create-race.mkv b/docs/videos/create-race.mkv index 769460a..c4e3f2b 100644 Binary files a/docs/videos/create-race.mkv and b/docs/videos/create-race.mkv differ diff --git a/docs/videos/event-manager-tabs.mkv b/docs/videos/event-manager-tabs.mkv index 9366436..44fff67 100644 Binary files a/docs/videos/event-manager-tabs.mkv and b/docs/videos/event-manager-tabs.mkv differ diff --git a/docs/videos/event-schedule.mkv b/docs/videos/event-schedule.mkv index c7d5f80..b87998e 100644 Binary files a/docs/videos/event-schedule.mkv and b/docs/videos/event-schedule.mkv differ diff --git a/docs/videos/judging.mkv b/docs/videos/judging.mkv new file mode 100644 index 0000000..b3b0518 Binary files /dev/null and b/docs/videos/judging.mkv differ diff --git a/docs/videos/practice-ranking.mkv b/docs/videos/practice-ranking.mkv new file mode 100644 index 0000000..94a2b5e Binary files /dev/null and b/docs/videos/practice-ranking.mkv differ diff --git a/docs/videos/race-overview.mkv b/docs/videos/race-overview.mkv new file mode 100644 index 0000000..360c28e Binary files /dev/null and b/docs/videos/race-overview.mkv differ diff --git a/docs/videos/run-a-session.mkv b/docs/videos/run-a-session.mkv index a64535d..edee3e3 100644 Binary files a/docs/videos/run-a-session.mkv and b/docs/videos/run-a-session.mkv differ diff --git a/docs/videos/settings-tabs.mkv b/docs/videos/settings-tabs.mkv index b907795..f4e3df5 100644 Binary files a/docs/videos/settings-tabs.mkv and b/docs/videos/settings-tabs.mkv differ diff --git a/docs/videos/sponsor-event.mkv b/docs/videos/sponsor-event.mkv new file mode 100644 index 0000000..59a7060 Binary files /dev/null and b/docs/videos/sponsor-event.mkv differ diff --git a/docs/videos/team-race.mkv b/docs/videos/team-race.mkv new file mode 100644 index 0000000..6f3b45a Binary files /dev/null and b/docs/videos/team-race.mkv differ diff --git a/package-lock.json b/package-lock.json index 3897e15..7e59d07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.70.1", + "version": "1.70.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.70.1", + "version": "1.70.2", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.11.1", diff --git a/package.json b/package.json index 750eece..a4615dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.70.1", + "version": "1.70.2", "private": true, "description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence", "engines": { diff --git a/scripts/record-video-guides.mjs b/scripts/record-video-guides.mjs index d042ddc..0ec5448 100644 --- a/scripts/record-video-guides.mjs +++ b/scripts/record-video-guides.mjs @@ -164,6 +164,9 @@ async function recordClip(name, { prepare, seedState, setup, steps }) { frameCount += 1; writeFileSync(join(framesDir, `frame_${String(frameCount).padStart(6, "0")}.jpg`), Buffer.from(data, "base64")); send("Page.screencastFrameAck", { sessionId }); + } else if (message.method === "Page.javascriptDialogOpening") { + // A confirm (e.g. "Disqualify ...?") would block headless Chrome: answer yes, as the clip shows. + send("Page.handleJavaScriptDialog", { accept: true }); } }); function send(method, params = {}) { @@ -286,21 +289,21 @@ const clips = { await scrollTo(".manage-tabs"); }, steps: [ - { text: "Opening Manage on a race event splits the page into four tabs: Setup, Format, Live, and Schedule." }, + { text: "Opening Manage on a race event splits the page into four tabs: Participants and teams, Format, Live and results, and Schedule and print." }, { text: "Format is where you configure practice, qualifying, and finals, and generate the session plan.", async action({ click, scrollTo }) { await click('[data-manage-tab="format"]'); await scrollTo('[data-manage-panel="format"]'); }, }, { - text: "Live shows the grid editor and every standings table while the race is running.", + text: "Live and results shows the grid editor and every standings table while the race is running.", async action({ click, scrollTo }) { await click('[data-manage-tab="live"]'); await scrollTo('[data-manage-panel="live"]'); }, }, { - text: "Schedule lets you set a start time and see the whole day's running order.", + text: "Schedule and print lets you set a start time, see the whole day's running order and print start lists.", async action({ click, scrollTo }) { await click('[data-manage-tab="schedule"]'); await scrollTo('[data-manage-panel="schedule"]'); }, }, { - text: "And Setup, where we started, is for managing participants and teams.", + text: "And Participants and teams, where we started, is for choosing who races.", async action({ click, scrollTo }) { await click('[data-manage-tab="setup"]'); await scrollTo('[data-manage-panel="setup"]'); }, }, { @@ -552,6 +555,273 @@ const clips = { }, ], }, + "sponsor-event": { + seedState(state) { + state.cars.push( + { id: "vid_sp_car1", name: "Rental 1", transponder: "7960001" }, + { id: "vid_sp_car2", name: "Rental 2", transponder: "7960002" }, + ); + state.events.push({ id: "vid_sp_event", name: "Company Day", date: "2026-09-19", mode: "track", sponsor: {}, raceConfig: {} }); + }, + async setup({ navigate, click, evaluate, scrollTo }) { + await navigate("events", "eventForm"); + await click("#event-manage-vid_sp_event"); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("sponsorSetupForm")`)), "sponsor setup"); + await scrollTo("#sponsorSetupForm", "center"); + }, + steps: [ + { text: "A sponsor event is set up in three steps, at the top of Manage: guests, cars and format." }, + { + text: "Paste the guests' names, one per line. They are not added to the club's driver list.", + async action({ evaluate }) { + await evaluate(`(() => { const area = document.querySelector("#sponsorSetupForm textarea[name=guests]"); area.value = "Anna\\nBosse\\nCissi\\nDavid\\nEmma\\nFilip"; area.dispatchEvent(new Event("input", { bubbles: true })); })()`); + }, + }, + { + text: "Tick the rental cars, or add a new one with its transponder.", + async action({ evaluate, fill, click }) { + await evaluate(`document.querySelectorAll("#sponsorSetupForm input[name=car]").forEach((box) => { if (!box.checked) box.click(); })`); + await fill("sponsorSetupForm", { newCarName: "Rental 3", newCarTp: "7960003" }); + await click("#sponsorAddCar"); + }, + }, + { + text: "Create the heats: practice and qualifying in groups, and the drivers swap cars between rounds.", + async action({ evaluate, scrollTo, pause: pauseFn }) { + await waitFor(async () => (await evaluate(`document.querySelectorAll("#sponsorSetupForm input[name=car]:checked").length`)) === 3, "three cars ticked"); + await evaluate(`(() => { const area = document.querySelector("#sponsorSetupForm textarea[name=guests]"); if (!area.value.trim()) area.value = "Anna\\nBosse\\nCissi\\nDavid\\nEmma\\nFilip"; document.getElementById("sponsorSetupForm").requestSubmit(); })()`); + await pauseFn(700); + await scrollTo("#manage-session-plan"); + }, + }, + { text: "When qualifying is done, one click creates the finals. Everything is then run from Race Day." }, + ], + }, + + "team-race": { + seedState(state) { + const classId = "vid_team_class"; + state.classes.push({ id: classId, name: "1:10 Touring" }); + const names = ["Alex Karlsson", "Sam Nilsson", "Jamie Lee", "Robin Berg", "Kim Ek", "Charlie Lund"]; + names.forEach((name, index) => state.drivers.push({ id: `vid_team_driver_${index}`, name, classId, transponder: `797000${index}` })); + ["Team car red", "Team car blue", "Team car green"].forEach((name, index) => state.cars.push({ id: `vid_team_car_${index}`, name, transponder: `797100${index}` })); + state.events.push({ + id: "vid_team_event", name: "Endurance Night", classId, mode: "race", + raceConfig: { presetId: "endurance", participantsConfigured: true, driverIds: names.map((_, index) => `vid_team_driver_${index}`), teams: [] }, + }); + }, + async setup({ navigate, click, evaluate, scrollTo }) { + await navigate("race_setup", "raceWizardStepForm"); + await click("#event-manage-vid_team_event"); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("teamSetupSplit")`)), "team setup"); + await scrollTo("#manage-setup-teams"); + }, + steps: [ + { text: "A team race is set up in three steps: teams, cars, and the length of the race." }, + { + text: "Choose how many teams, and split the drivers. Names and drivers can be changed by hand.", + async action({ evaluate, click }) { + await evaluate(`document.getElementById("teamSetupCount").value = "3"`); + await click("#teamSetupSplit"); + await waitFor(async () => (await evaluate(`document.querySelectorAll(".team-setup-card").length`)) === 3, "three teams"); + }, + }, + { + text: "Give each team its car. The car's transponder counts for every driver on the team.", + async action({ evaluate, pause: pauseFn }) { + for (let index = 0; index < 3; index += 1) { + await evaluate(`(() => { const select = document.querySelectorAll("[data-team-car]")[${index}]; select.value = "vid_team_car_${index}"; select.dispatchEvent(new Event("change")); })()`); + await pauseFn(500); + } + }, + }, + { + text: "Pick the length, here four hours. The checks below show anything that would stop the start.", + async action({ click, scrollTo }) { + await click('[data-team-length="240"]'); + await scrollTo("#teamSetupCreate", "center"); + }, + }, + { + text: "Create the team race. Teams can still be changed while it runs, if a transponder or a car has to be swapped.", + async action({ click, scrollTo }) { await click("#teamSetupCreate"); await pause(400); await scrollTo("#teamSetupLength", "center"); }, + }, + ], + }, + + "practice-ranking": { + seedState(state) { + const startedAt = Date.now() - 600000; + const event = { id: "vid_rank_event", name: "Thursday Practice", date: new Date().toISOString().slice(0, 10), classId: "", mode: "race", raceConfig: { practiceOnly: true } }; + const practice = { id: "vid_rank_practice", eventId: event.id, name: "Open Practice", type: "open_practice", durationMin: 600, status: "running", startedAt }; + const drivers = [["Alex Karlsson", [16900, 24500, 23800, 24100]], ["Sam Nilsson", [17600, 17700, 17650, 17800]], ["Jamie Lee", [18200, 18100, 18300, 18000]], ["Robin Berg", [17300, 21000, 19500, 22000]]]; + const passings = []; + const competitors = {}; + drivers.forEach(([name, lapTimes], index) => { + const id = `vid_rank_driver_${index}`; + const tp = `798000${index}`; + state.drivers.push({ id, name, classId: "", transponder: tp }); + let ts = startedAt + 4000 + index * 900; + passings.push({ driverId: id, driverName: name, competitorKey: id, transponder: tp, lapMs: 0, timestamp: ts, validLap: true }); + lapTimes.forEach((lapMs) => { ts += lapMs; passings.push({ driverId: id, driverName: name, competitorKey: id, transponder: tp, lapMs, timestamp: ts, validLap: true }); }); + competitors[id] = { key: id, driverId: id, driverName: name, transponder: tp, laps: lapTimes.length, bestLapMs: Math.min(...lapTimes), lastLapMs: lapTimes.at(-1), startTimestamp: startedAt }; + }); + state.events.push(event); + state.sessions.push(practice); + state.resultsBySession[practice.id] = { passings: passings.sort((a, b) => a.timestamp - b.timestamp), competitors }; + state.activeSessionId = practice.id; + }, + async setup({ navigate }) { + await navigate("overlay", "overlayFullscreen"); + }, + steps: [ + { text: "Open practice ranks drivers by their single best lap. One lucky lap puts you on top." }, + { + text: "In Race Setup, the practice's Settings button lets you change that.", + async action({ navigate, evaluate, scrollTo }) { + await navigate("race_setup", "raceWizardStepForm"); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("event-edit-vid_rank_event")`)), "practice in the list"); + await scrollTo("#event-edit-vid_rank_event", "center"); + }, + }, + { + text: "Rank by the best three laps in a row, or the most laps in a set number of minutes. The lap time window is here too.", + async action({ click, evaluate }) { + await click("#event-edit-vid_rank_event"); + await waitFor(async () => Boolean(await evaluate(`document.querySelector('#eventEditForm [name="practiceRanking"]')`)), "settings window"); + await evaluate(`(() => { const form = document.getElementById("eventEditForm"); form.elements.practiceRanking.value = "consecutive"; form.elements.practiceRanking.dispatchEvent(new Event("change", { bubbles: true })); form.elements.practiceRankLaps.value = "3"; })()`); + }, + }, + { + text: "Save, and the results and the overlay follow at once. Now the steadiest driver leads.", + async action({ evaluate, clickNav }) { + await evaluate(`(() => { const form = document.getElementById("eventEditForm"); if (!form.elements.date.value) form.elements.date.value = "2026-09-17"; form.requestSubmit(); })()`); + await pause(600); + await clickNav("Overlay"); + }, + }, + ], + }, + + "race-overview": { + seedState(state) { + const classId = "vid_ov_class"; + state.classes.push({ id: classId, name: "2WD Buggy" }); + const names = ["Alex Karlsson", "Sam Nilsson", "Jamie Lee", "Robin Berg"]; + const ids = names.map((name, index) => { const id = `vid_ov_driver_${index}`; state.drivers.push({ id, name, classId, transponder: `799000${index}` }); return id; }); + const event = { id: "vid_ov_event", name: "Club Race Night", date: "2026-09-18", classId, mode: "race", raceConfig: { participantsConfigured: true, driverIds: ids } }; + state.events.push(event); + // Each heat: who finished where (laps, best lap) - ends a few minutes apart. + const heats = [ + ["vid_ov_p1", "Practice 1", "practice", [2, 0, 1, 3]], + ["vid_ov_q1", "Q1 H1", "qualification", [0, 2, 1, 3]], + ["vid_ov_q2", "Q2 H1", "qualification", [0, 1, 2, 3]], + ["vid_ov_a", "A Final", "final", [1, 0, 2, 3]], + ]; + const dayStart = Date.now() - 4 * 3600000; + heats.forEach(([id, name, type, order], heatIndex) => { + const startedAt = dayStart + heatIndex * 1800000; + state.sessions.push({ id, eventId: event.id, name, type, durationMin: 5, status: "finished", startedAt, endedAt: startedAt + 310000, driverIds: ids }); + const competitors = {}; + order.forEach((driverIndex, place) => { + const key = ids[driverIndex]; + competitors[key] = { key, driverId: key, driverName: names[driverIndex], displayName: names[driverIndex], transponder: `799000${driverIndex}`, laps: 17 - place, bestLapMs: 17100 + place * 230 + heatIndex * 40, lastLapMs: 18000, startTimestamp: startedAt, lastTimestamp: startedAt + 300000 + place * 1200 }; + }); + state.resultsBySession[id] = { passings: [], adjustments: [], competitors }; + }); + state.activeSessionId = "vid_ov_a"; + }, + async setup({ navigate, evaluate, scrollTo }) { + await navigate("race_day", "raceDayOverview"); + await scrollTo("#raceDayOverview"); + }, + steps: [ + { text: "When a race is run, Race Day shows the whole race in one place: the podium, then practice, qualifying and finals." }, + { + text: "Open a part to see its standings, and every heat with laps, result and best lap.", + async action({ evaluate }) { await evaluate(`document.querySelector('.race-overview-phase[data-phase="qualification"]')?.setAttribute("open", "")`); }, + }, + { + text: "Print it, or export the whole race as PDF or CSV.", + async action({ evaluate, scrollTo }) { + await evaluate(`document.querySelector('.race-overview-phase[data-phase="qualification"]')?.removeAttribute("open"); document.querySelector('.race-overview-phase[data-phase="final"]')?.setAttribute("open", "")`); + await scrollTo("#raceDayOverview"); + }, + }, + { + text: "The results archive is sorted by race. Pick one, and the same overview and export are there.", + async action({ clickNav, evaluate, click, scrollTo }) { + await clickNav("Results archive"); + await waitFor(async () => Boolean(await evaluate(`document.querySelector('[data-archive-event="vid_ov_event"]')`)), "race in the archive"); + await click('[data-archive-event="vid_ov_event"]'); + await pause(500); + await scrollTo("#archiveEventClose", "center"); + }, + }, + ], + }, + + judging: { + seedState(state) { + const classId = "vid_judge_class"; + state.classes.push({ id: classId, name: "2WD Buggy" }); + const names = ["Alex Karlsson", "Sam Nilsson", "Jamie Lee"]; + const ids = names.map((name, index) => { const id = `vid_judge_driver_${index}`; state.drivers.push({ id, name, classId, transponder: `796100${index}` }); return id; }); + const event = { id: "vid_judge_event", name: "Club Race Night", classId, mode: "race", raceConfig: { participantsConfigured: true, driverIds: ids } }; + state.events.push(event); + const now = Date.now(); + const qualiStart = now - 1800000; + const heatStart = now - 90000; + state.sessions.push( + { id: "vid_judge_q1", eventId: event.id, name: "Q1 H1", type: "qualification", durationMin: 5, status: "finished", startedAt: qualiStart, endedAt: qualiStart + 305000, driverIds: ids }, + { id: "vid_judge_q2", eventId: event.id, name: "Q2 H1", type: "qualification", durationMin: 5, status: "running", startedAt: heatStart, driverIds: ids }, + ); + const competitors = (startedAt, laps) => Object.fromEntries(ids.map((key, index) => [key, { key, driverId: key, driverName: names[index], displayName: names[index], transponder: `796100${index}`, laps: laps - index, bestLapMs: 17200 + index * 300, lastLapMs: 18000, startTimestamp: startedAt, lastTimestamp: startedAt + laps * 17800 + index * 900 }])); + state.resultsBySession.vid_judge_q1 = { passings: [], adjustments: [], competitors: competitors(qualiStart, 17) }; + state.resultsBySession.vid_judge_q2 = { passings: [], adjustments: [], competitors: competitors(heatStart, 5) }; + state.activeSessionId = "vid_judge_q2"; + state.settings.raceAudio = { ...state.settings.raceAudio, events: SILENCED_EVENTS }; + }, + async setup({ navigate }) { + await navigate("judging", "speakerPanel"); + }, + steps: [ + { text: "Judging is the race controller's page. The speaker panel has the track calls, marshal warning and quick sound switches." }, + { + text: "Pick a driver to see the penalties, and write the reason. It is saved in the judging log.", + async action({ click, evaluate, scrollTo }) { + await click("#judge-select-vid_judge_driver_1"); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("judgeReason")`)), "driver selected"); + await evaluate(`document.getElementById("judgeReason").value = "Pushed another car off"`); + await scrollTo("#judgeReason", "center"); + }, + }, + { + text: "During the heat, call the driver: attention, an official warning, a stop and go, or a drive through. The speaker reads out the driver's name.", + async action({ click, scrollTo }) { await scrollTo('[data-judge-call="stop_and_go"]', "center"); await click('[data-judge-call="stop_and_go"]'); }, + }, + { + text: "Finished heats can be judged afterwards too, after a protest or a car check. Pick the heat here.", + async action({ evaluate, scrollTo }) { + await evaluate(`(() => { const select = document.getElementById("judgingSessionSelect"); select.value = "vid_judge_q1"; select.dispatchEvent(new Event("change")); })()`); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("judge-select-vid_judge_driver_0")`)), "finished heat"); + await scrollTo("#judgingSessionSelect", "center"); + }, + }, + { + text: "Give a time penalty with a reason, or disqualify. Following the EFRA rules, a disqualified driver goes last.", + async action({ click, evaluate, scrollTo }) { + await click("#judge-select-vid_judge_driver_0"); + await waitFor(async () => Boolean(await evaluate(`document.getElementById("judgeDsq")`)), "penalty buttons"); + await evaluate(`document.getElementById("judgeReason").value = "Car under weight"`); + await click("#judgeDsq"); + await pause(600); + await scrollTo("#judgingCompetitorFilter", "center"); + }, + }, + { text: "Everything follows straight away: results, standings, the race overview and the archive. And every change can be undone from the log." }, + ], + }, }; const requested = process.argv.slice(2); diff --git a/src/app.js b/src/app.js index 2480184..9fa5fa2 100644 --- a/src/app.js +++ b/src/app.js @@ -2018,6 +2018,11 @@ const TRANSLATIONS = { "guide.video_settings_tabs": "Settings-flikarna", "guide.video_event_manager_tabs": "Event Manager-flikarna", "guide.video_event_schedule": "Race day-schemat", + "guide.video_sponsor_event": "Sponsorevent – snabbuppsättning", + "guide.video_team_race": "Lagrace – lag, bilar och längd", + "guide.video_practice_ranking": "Öppen träning – ranking på varv i rad", + "guide.video_race_overview": "Race-översikt och resultatarkiv", + "guide.video_judging": "Domare – utrop, straff och DSQ", "guide.tab_start": "Kom igång", "guide.tab_create": "Skapa ett race", "guide.tab_run": "Köra ett race", @@ -4137,6 +4142,11 @@ const TRANSLATIONS = { "guide.video_settings_tabs": "The Settings tabs", "guide.video_event_manager_tabs": "The Event Manager tabs", "guide.video_event_schedule": "The race day schedule", + "guide.video_sponsor_event": "Sponsor event – quick setup", + "guide.video_team_race": "Team race – teams, cars and length", + "guide.video_practice_ranking": "Open practice – ranking by laps in a row", + "guide.video_race_overview": "Race overview and results archive", + "guide.video_judging": "Judging – calls, penalties and DSQ", "guide.tab_start": "Getting started", "guide.tab_create": "Create a race", "guide.tab_run": "Run a race", diff --git a/src/event_race_logic.js b/src/event_race_logic.js index fd5da69..85cf75a 100644 --- a/src/event_race_logic.js +++ b/src/event_race_logic.js @@ -269,6 +269,8 @@ export function normalizeEvent(event, { normalizeBrandingConfig, normalizeStartM finalsSource: event?.raceConfig?.finalsSource === "practice" ? "practice" : "qualifying", teams: Array.isArray(event?.raceConfig?.teams) ? event.raceConfig.teams.map((team) => normalizeRaceTeam(team)).filter((team) => team.name) : [], practiceOnly: event?.raceConfig?.practiceOnly === true, + // Team race length chosen in Manage before the team race session exists (minutes). + ...(Number(event?.raceConfig?.teamRaceDurationMin) > 0 ? { teamRaceDurationMin: Math.min(1440, Math.round(Number(event.raceConfig.teamRaceDurationMin))) } : {}), scheduleStartAt: Number(event?.raceConfig?.scheduleStartAt) > 0 ? Number(event.raceConfig.scheduleStartAt) : null, // 0 is a valid gap (back-to-back sessions), so this can't use || - only a genuinely // non-numeric/missing value should fall back to the 3-minute default. diff --git a/src/misc_views.js b/src/misc_views.js index cf3e0d2..49eaafb 100644 --- a/src/misc_views.js +++ b/src/misc_views.js @@ -157,6 +157,11 @@ export function renderGuideView({ dom, t }) {
  • ${t("guide.video_settings_tabs")}
  • ${t("guide.video_event_manager_tabs")}
  • ${t("guide.video_event_schedule")}
  • +
  • ${t("guide.video_sponsor_event")}
  • +
  • ${t("guide.video_team_race")}
  • +
  • ${t("guide.video_practice_ranking")}
  • +
  • ${t("guide.video_race_overview")}
  • +
  • ${t("guide.video_judging")}
  • diff --git a/tests/browser_guide_tabs.js b/tests/browser_guide_tabs.js index b264c48..192353d 100644 --- a/tests/browser_guide_tabs.js +++ b/tests/browser_guide_tabs.js @@ -45,7 +45,7 @@ export async function runGuideTabsSmoke({ evaluate, navigate }) { console.log("PASS the guide has a Series / cup tab with the whole workflow"); const videoLinkCount = await evaluate(`document.querySelectorAll('[data-guide-panel="videos"] a[href^="/docs/videos/"]').length`); - assert.equal(videoLinkCount, 7, "all 7 video guide links live under the Video guides tab"); + assert.equal(videoLinkCount, 12, "all 12 video guide links live under the Video guides tab"); await evaluate(`document.querySelector('[data-guide-tab="run"]').click()`); assert.equal(await activeTab(), "run"); diff --git a/tests/race_timing_logic.test.js b/tests/race_timing_logic.test.js index dc8bfda..8254b6d 100644 --- a/tests/race_timing_logic.test.js +++ b/tests/race_timing_logic.test.js @@ -152,6 +152,12 @@ test("event normalization preserves the practice-only marker", () => { assert.equal(event.raceConfig.presetId, "custom"); }); +test("event normalization keeps the team race length chosen before the race is created", () => { + const deps = { normalizeBrandingConfig: (branding) => branding || {}, normalizeStartMode, normalizeRaceTeam: (team) => team }; + assert.equal(normalizeEvent({ id: "e", raceConfig: { teamRaceDurationMin: 240 } }, deps).raceConfig.teamRaceDurationMin, 240); + assert.equal("teamRaceDurationMin" in normalizeEvent({ id: "e", raceConfig: {} }, deps).raceConfig, false); +}); + test("reassignTeamMembers strips a moved driver/car from every other team, leaving the excluded team untouched", () => { const teams = [ { id: "team_a", name: "A", driverIds: ["d1", "d2"], carIds: ["c1"] },