diff --git a/CHANGELOG.md b/CHANGELOG.md index c25071d..44241b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ The application version is maintained in `package.json` and displayed in the adm No changes recorded yet. +## 1.67.1 + +- Team race: the teams can still be changed while the race runs (a wrong transponder, a broken car swapped for another): laps stay with the team, a change counts from the next passing. Locked only once the race is finished. +- Team race length: quick picks 30 min, 1 h, 2 h, 4 h, 6 h, 12 h and 24 h, and the length is shown in hours. It can be changed while the race runs too. + ## 1.67.0 - Team race setup in one panel (Events → Manage), replacing the separate team form, checkbox lists and edit window: 1 teams and drivers (split the chosen drivers over N teams in one click, rename a team in place, add a driver from a list that says which team they move from, remove with ×), a car per team or the drivers' own transponders, 2 the length, with "Create team race" when there is no team race session yet, 3 the checks before the start (fewer than two teams, a team without drivers or transponder, a transponder on two teams, drivers on no team). Shown as soon as the endurance format is picked. Locked once the race has started. diff --git a/package-lock.json b/package-lock.json index f510be7..2ddeb2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.67.0", + "version": "1.67.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.67.0", + "version": "1.67.1", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.11.1", diff --git a/package.json b/package.json index a9defc2..395cf22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.67.0", + "version": "1.67.1", "private": true, "description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence", "engines": { diff --git a/src/app.js b/src/app.js index 50f5875..7f30251 100644 --- a/src/app.js +++ b/src/app.js @@ -2866,6 +2866,7 @@ const TRANSLATIONS = { "team_setup.length_min": "Längd (minuter)", "team_setup.create_race": "Skapa lagrace", "team_setup.locked": "Lagracet är {status} – lagen kan inte ändras.", + "team_setup.live_hint": "Lagracet pågår. Du kan fortfarande byta förare, bil och transponder – ändringen gäller från nästa passering och varven som körts stannar hos laget.", "team_setup.unplaced": "Inte i något lag: {names}", "team_setup.issue_no_teams": "Minst två lag behövs.", "team_setup.issue_empty": "{team} har inga förare.", @@ -4938,6 +4939,7 @@ const TRANSLATIONS = { "team_setup.length_min": "Length (minutes)", "team_setup.create_race": "Create team race", "team_setup.locked": "The team race is {status} – the teams can't be changed.", + "team_setup.live_hint": "The team race is on. You can still change drivers, car and transponder – it counts from the next passing and the laps already done stay with the team.", "team_setup.unplaced": "On no team: {names}", "team_setup.issue_no_teams": "At least two teams are needed.", "team_setup.issue_empty": "{team} has no drivers.", diff --git a/src/team_race_setup_view.js b/src/team_race_setup_view.js index c840d23..5023a71 100644 --- a/src/team_race_setup_view.js +++ b/src/team_race_setup_view.js @@ -3,6 +3,13 @@ // Logic in team_race_logic.js; this file only renders and binds. import { splitIntoTeams, moveDriverToTeam, setTeamCar, renameTeam, removeTeam, getTeamTransponders, findTeamRaceIssues } from "./team_race_logic.js"; +const LENGTH_PRESETS = [30, 60, 120, 240, 360, 720, 1440]; +const formatLength = (minutes) => { + const hours = Math.floor(minutes / 60); + const rest = minutes % 60; + return hours ? `${hours} h${rest ? ` ${rest} min` : ""}` : `${rest} min`; +}; + export function mountTeamRaceSetup(root, deps) { if (!root) return; const { event, state, t, escapeHtml, uid, saveState, refresh, getSessionsForEvent, getEventTeams, getTeamDriverPool, normalizeSession, getStatusLabel } = deps; @@ -10,7 +17,10 @@ export function mountTeamRaceSetup(root, deps) { const pool = getTeamDriverPool(event); const poolIds = pool.drivers.map((driver) => driver.id); const session = getSessionsForEvent(event.id).find((item) => item.type === "team_race") || null; - const editable = !session || session.status === "ready"; + // Teams stay editable while the race runs (wrong transponder, a broken car swapped): laps are + // kept per team, so a change only counts from the next passing. Locked once it is finished. + const editable = !session || !["finished", "stopped"].includes(session.status); + const live = Boolean(session && ["running", "paused"].includes(session.status)); const lengthMin = Math.max(1, Number(session?.durationMin || event.raceConfig?.teamRaceDurationMin || 60) || 60); const issues = findTeamRaceIssues(teams, { drivers: state.drivers, cars: state.cars, driverIds: pool.fallback ? [] : poolIds }); const driver = (id) => state.drivers.find((item) => item.id === id); @@ -55,16 +65,21 @@ export function mountTeamRaceSetup(root, deps) {
${t("team_setup.intro")}
${pool.fallback ? `${t("events.team_driver_fallback")}
` : ""}${t("team_setup.locked", { status: getStatusLabel(session.status) })}
`}${t("events.no_teams")}
`}${t("team_setup.unplaced", { names: unplaced.join(", ") })}
` : ""}