feat(houseofrc): preview and send results to the event's entries, heats or final placings (1.83.0)

This commit is contained in:
larssand committed 2026-11-08 20:44:23 +01:00
1 parent f4a62b92d2
commit ebdc6104e6
17 files changed
+295 -15

No files matched your search

+20
View File
@@ -83,6 +83,10 @@ export async function runHouseOfRcEventSmoke({ evaluate, navigate, savedState, w
{ entryId: 13, classId: 555, houseOfRcId: 903, name: "HoR Skipped", number: null, transponders: [], club: "", car: "" },
{ entryId: 14, classId: 556, houseOfRcId: 904, name: "HoR Other Class", number: null, transponders: [], club: "", car: "" },
] });
if (String(url).includes("/api/houseofrc/results")) {
window.__horPosted = JSON.parse(options.body);
return json({ ok: true, updated: window.__horPosted.entries.length, entries: [] });
}
return realFetch(url, options);
};
})()`);
@@ -137,6 +141,22 @@ export async function runHouseOfRcEventSmoke({ evaluate, navigate, savedState, w
assert.equal(Object.keys(race.houseOfRc.entryIds).length, 2);
}
console.log("PASS House of RC re-fetch in Manage: late entries added, withdrawn drivers taken out");
// Manage → "Send results to House of RC": nothing raced yet, so heats mode, no placings.
await waitFor(async () => evaluate(`Boolean(document.getElementById("houseOfRcSendResults"))`), "the send results button in Manage");
await evaluate(`document.getElementById("houseOfRcSendResults").click()`);
await waitFor(async () => evaluate(`Boolean(document.querySelector("#houseOfRcResultsOverlay [data-hor-send]"))`), "the results preview");
assert.equal(await evaluate(`document.querySelectorAll("#houseOfRcResultsOverlay [data-hor-result-row]").length`), 2);
assert.equal(await evaluate(`document.querySelector('[name=horResultsMode][value=final]').disabled`), true, "no finals yet: final results cannot be picked");
await evaluate(`document.querySelector("#houseOfRcResultsOverlay [data-hor-send]").click()`);
await waitFor(async () => evaluate(`Boolean(window.__horPosted)`), "the results are posted");
const posted = await evaluate(`window.__horPosted`);
assert.equal(posted.eventId, 2251);
assert.deepEqual(posted.entries.map((entry) => entry.id).sort(), [11, 16]);
assert.ok(posted.entries.every((entry) => !("ranking" in entry)), "no placing sent before the finals");
await waitFor(async () => Boolean((await savedState()).events.find((item) => item.houseOfRc?.eventId === 2251)?.houseOfRc.resultsSentAt), "when it was sent is saved");
await evaluate(`document.getElementById("houseOfRcResultsOverlay")?.remove()`);
console.log("PASS House of RC results: preview in Manage, heats sent to the race's entries without placings");
} finally {
await evaluate(`document.getElementById("houseOfRcEventOverlay")?.remove()`).catch(() => {});
const current = await savedState();