From f14cdb8c9777b809bdacab91b99b573602e5dd44 Mon Sep 17 00:00:00 2001 From: larssand Date: Sun, 8 Nov 2026 21:11:23 +0100 Subject: [PATCH] fix(houseofrc): link hand-added drivers who enter later; fix qualifying rounds hint in the race wizard (1.84.1) --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/app.js | 4 ++++ src/houseofrc_logic.js | 7 +++++-- src/houseofrc_view.js | 2 +- src/race_setup_ui.js | 4 ++-- tests/houseofrc_logic.test.js | 7 +++++++ 8 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d5f99..50a47ab 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.84.1 + +- **House of RC:** a driver you added to the race by hand who later enters on House of RC is now linked to that entry by **🔄 Fetch changes from House of RC** ("Already racing – linked to the entry"), so their results are sent too. Before, they were skipped and their results never reached House of RC. +- **Race wizard:** the field *Qualifying rounds* had the help text for the heat length ("Length of each qualifying heat in minutes"). It now says how many rounds are made; the length comes from the format and is changed under Manage → Format. + ## 1.84.0 - **Create finals from Race Day:** when the last qualifying heat of a race has run (or its practice, when the finals are seeded from practice) and it has no finals yet, Race Day shows **🏁 All qualifying run – create finals** next to the heat controls. It does the same as Manage → Format → Create finals from qualifying and takes you to the first final. diff --git a/package-lock.json b/package-lock.json index ab760a6..4bfbedb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.84.0", + "version": "1.84.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.84.0", + "version": "1.84.1", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.11.1", diff --git a/package.json b/package.json index afe6f33..d81d222 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.84.0", + "version": "1.84.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 9297af1..f621bdc 100644 --- a/src/app.js +++ b/src/app.js @@ -2222,6 +2222,7 @@ const TRANSLATIONS = { "houseofrc.entries_class": "Klass hos oss", "houseofrc.entries_hor_class": "Klass pĂ„ House of RC", "houseofrc.refresh_button": "HĂ€mta Ă€ndringar frĂ„n House of RC", + "houseofrc.refresh_link_only": "Kör redan – kopplas till anmĂ€lan", "houseofrc.results_button": "Skicka resultat till House of RC", "houseofrc.results_hint": "Förhandsgranska och skicka resultatet till {name}", "houseofrc.results_title": "Skicka resultat till House of RC", @@ -2336,6 +2337,7 @@ const TRANSLATIONS = { "events.qualifying_scoring_best": "BĂ€sta runda / rank", "events.qualifying_rounds": "Antal kvalrundor", "events.qualifying_rounds_hint": "Hur mĂ„nga kvalomgĂ„ngar som ska skapas totalt.", + "events.wizard_use_qualifying_hint": "Kvalet ger placeringen in i finalerna. LĂ€ngd och startsĂ€tt kommer frĂ„n formatet och kan Ă€ndras i Hantera → Format.", "events.cars_per_heat": "Förare per kvalheat", "events.cars_per_heat_hint": "Hur mĂ„nga förare som placeras i varje kvalheat.", "events.qual_duration": "Kvaltid (min)", @@ -4463,6 +4465,7 @@ const TRANSLATIONS = { "houseofrc.entries_class": "Our class", "houseofrc.entries_hor_class": "Class on House of RC", "houseofrc.refresh_button": "Fetch changes from House of RC", + "houseofrc.refresh_link_only": "Already racing – linked to the entry", "houseofrc.results_button": "Send results to House of RC", "houseofrc.results_hint": "Preview and send the results to {name}", "houseofrc.results_title": "Send results to House of RC", @@ -4577,6 +4580,7 @@ const TRANSLATIONS = { "events.qualifying_scoring_best": "Best round / rank", "events.qualifying_rounds": "Qualifying rounds", "events.qualifying_rounds_hint": "How many qualifying rounds should be generated in total.", + "events.wizard_use_qualifying_hint": "Qualifying decides who goes into which final. Length and start mode come from the format and can be changed in Manage → Format.", "events.cars_per_heat": "Drivers per qualifying heat", "events.cars_per_heat_hint": "How many drivers go into each qualifying heat.", "events.qual_duration": "Qualifying duration (min)", diff --git a/src/houseofrc_logic.js b/src/houseofrc_logic.js index 5674513..44a3e0c 100644 --- a/src/houseofrc_logic.js +++ b/src/houseofrc_logic.js @@ -141,7 +141,7 @@ export function rememberHouseOfRcClass(classes = [], classId = "", name = "") { // Re-fetch for a race made from House of RC: which entries of its class are new, and which of // our participants' entries are gone (withdrawn or moved to the waiting list - the server -// leaves those out). Participants added by hand (no entry id) are never touched. +// leaves those out). Participants added by hand (no entry id) are never taken out. export function diffHouseOfRcEntries(event, entries = [], drivers = []) { const link = event?.houseOfRc || {}; const entryIds = link.entryIds || {}; @@ -149,7 +149,10 @@ export function diffHouseOfRcEntries(event, entries = [], drivers = []) { const classEntries = entries.filter((entry) => link.classId == null || entry.classId === link.classId); const known = new Set(Object.entries(entryIds).filter(([driverId]) => participants.has(driverId)).map(([, entryId]) => entryId)); const plan = planHouseOfRcEntries(classEntries, drivers, event?.classId || ""); - const added = plan.filter((row) => !known.has(row.entry.entryId) && !(row.driverId && participants.has(row.driverId) && entryIds[row.driverId] == null)); + // A participant added by hand who has now entered on House of RC is linked to the entry + // (linkOnly: already racing, so only the entry id is recorded, for the results). + const added = plan.filter((row) => !known.has(row.entry.entryId)) + .map((row) => (row.driverId && participants.has(row.driverId) ? { ...row, linkOnly: true } : row)); const current = new Set(classEntries.map((entry) => entry.entryId)); const withdrawn = Object.entries(entryIds) .filter(([driverId, entryId]) => participants.has(driverId) && !current.has(entryId)) diff --git a/src/houseofrc_view.js b/src/houseofrc_view.js index 18bd013..233570d 100644 --- a/src/houseofrc_view.js +++ b/src/houseofrc_view.js @@ -330,7 +330,7 @@ export async function openHouseOfRcEntryRefresh({ event, state, t, escapeHtml, m
${diff.added.map((row, index) => ` - + `).join("")}
${escapeHtml(row.entry.name)}${escapeHtml(row.entry.club || "–")}${escapeHtml(row.entry.car || "–")}${escapeHtml(row.transponder || "–")}${escapeHtml(t(`houseofrc.entry_${row.status}`))}${escapeHtml(t(row.linkOnly ? "houseofrc.refresh_link_only" : `houseofrc.entry_${row.status}`))}
` : ""} ${diff.withdrawn.length ? `

➖ ${escapeHtml(t("houseofrc.refresh_withdrawn", { count: diff.withdrawn.length }))}

${diff.withdrawn.map((driver) => ` diff --git a/src/race_setup_ui.js b/src/race_setup_ui.js index dad0178..73ae725 100644 --- a/src/race_setup_ui.js +++ b/src/race_setup_ui.js @@ -154,12 +154,12 @@ export function renderRaceWizardContent(draft, classOptions, wizardDrivers, pres ${!isEndurance ? ` ` : ` diff --git a/tests/houseofrc_logic.test.js b/tests/houseofrc_logic.test.js index 4fab962..c68d714 100644 --- a/tests/houseofrc_logic.test.js +++ b/tests/houseofrc_logic.test.js @@ -104,6 +104,13 @@ test("House of RC re-fetch: late entries are added, withdrawn ones offered for r assert.deepEqual(event.houseOfRc.entryIds, { a: 11, late: 14 }); assert.equal(drivers.find((driver) => driver.id === "late").transponder, "9"); assert.deepEqual(diffHouseOfRcEntries({ ...event, raceConfig: { driverIds: ids } }, entries, drivers), { added: [], withdrawn: [] }, "fetching again finds nothing new"); + // The hand-added driver enters on House of RC later: linked, not added twice. + event.raceConfig.driverIds = ids; + const later = diffHouseOfRcEntries(event, [...entries, { entryId: 17, classId: 555, houseOfRcId: 10, name: "Hand Added", transponders: ["3"] }], drivers); + assert.deepEqual(later.added.map((row) => [row.entry.name, Boolean(row.linkOnly)]), [["Hand Added", true]]); + const linkedIds = applyHouseOfRcEntryChanges(event, drivers, later, { addIndexes: new Set([0]), removeIds: new Set(), makeDriver: () => { throw new Error("no new driver"); } }); + assert.deepEqual(linkedIds, ["a", "h", "late"], "same participants, same order"); + assert.equal(event.houseOfRc.entryIds.h, 17, "now gets its results sent"); }); test("House of RC results: heats and qualifying without placings, then final placings by main", async () => {