feat(houseofrc): send heats automatically after every heat, show send status, warn before sending (1.85.0)

This commit is contained in:
larssand committed 2026-11-08 23:19:43 +01:00
1 parent 38cfa7ff2d
commit 3870510d8c
15 files changed
+189 -18

No files matched your search

+43 -2
View File
@@ -6,6 +6,8 @@ import { getOverlayModeLabel, buildOverlayPanels, renderOverlaySidePanel, render
import { renderSettings, openSettingsTab } from "./settings.js";
import { buildRaceDayQueue, buildRaceDayPreflight, getRaceDriverIds, shouldOfferFinals } from "./race_day_logic.js";
import { findHouseOfRcAutoSends } from "./houseofrc_logic.js";
import { sendHouseOfRcResults, renderHouseOfRcSendStatus } from "./houseofrc_view.js";
import { recordTransponderSighting, buildWarmupCheck, createPrologue, getPrologueRemainingMs, holdPrologue, resumePrologue, setPrologueRemaining, takeDuePrologueCall, formatPrologueTime, getPrologueHandoverMs, normalizePrologueSec, getPrologueMarks } from "./prologue_logic.js";
import { findTransponderConflict, getDriverProfileId } from "./driver_profile_logic.js";
import { renderRaceDayView, refreshRaceDayWarmup, refreshRaceDayPrologueClock, updateRaceDayStartDisplay, refreshRaceDayLive } from "./race_day_view.js";
@@ -518,6 +520,23 @@ function buildHeatCallDrivers(session) {
function getDueCallFor(date) {
return getDueCall(buildDayRows(date), { day: getDayPlan(date), snoozedUntil: (id) => callSnoozes.get(id) || 0 });
}
// House of RC "send heats automatically": the race controller sends heats and qualifying of
// every race where a heat has finished since the last send; never the final placings.
// A failed send is tried again a minute later (findHouseOfRcAutoSends).
let houseOfRcAutoSendBusy = false;
async function tickHouseOfRcAutoSend() {
if (overlayMode || houseOfRcAutoSendBusy || !isRaceMaster()) return;
const due = findHouseOfRcAutoSends(state);
if (!due.length) return;
houseOfRcAutoSendBusy = true;
try {
for (const event of due) await sendHouseOfRcResults({ event, overview: getRaceOverview(event), state, final: false });
saveState();
if (currentView === "race_day") renderView();
} finally {
houseOfRcAutoSendBusy = false;
}
}
function tickDayCalls() {
if (overlayMode || !isRaceMaster()) return;
if (autopilotDate) {
@@ -755,6 +774,7 @@ const renderRaceDay = () => renderRaceDayView({
setCompetitorLapStatus,
...speakerPanelDeps,
shouldOfferFinals: (eventId) => shouldOfferFinals(state, eventId),
renderHouseOfRcStatus: (eventId) => renderHouseOfRcSendStatus(state.events.find((event) => event.id === eventId), { t, escapeHtml }),
createFinalsForEvent: (eventId) => {
const event = state.events.find((item) => item.id === eventId);
if (!event || !generateFinalsForRace(event)) return null;
@@ -2223,6 +2243,17 @@ 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.auto_send": "Skicka heat automatiskt",
"houseofrc.auto_send_hint": "Efter varje heat skickar race controller-datorn heat och kval till House of RC (inte slutplaceringen). Utan internet försöker den igen varje minut.",
"houseofrc.status_auto_waiting": "Skickas efter nästa heat",
"houseofrc.status_sent_heats": "Skickat {time} · heat",
"houseofrc.status_sent_final": "Skickat {time} · slutresultat",
"houseofrc.status_failed": "Kunde inte skicka {time}",
"houseofrc.status_failed_retry": "Väntar på att skicka ({time}) – försöker igen",
"houseofrc.warn_running": "Ett heat körs just nu – dess resultat är inte klart.",
"houseofrc.warn_finals_left": "Finaler som inte är körda: {names}.",
"houseofrc.warn_missing": "{count} deltagare saknar anmälan på House of RC och kommer inte med.",
"houseofrc.warn_unchanged": "Inget har ändrats sedan senaste utskicket.",
"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}",
@@ -2240,7 +2271,6 @@ const TRANSLATIONS = {
"houseofrc.results_send": "Skicka ({count})",
"houseofrc.results_sending": "Skickar …",
"houseofrc.results_sent": "{count} anmälningar uppdaterade på House of RC.",
"houseofrc.results_last": "senast skickat {time}",
"houseofrc.results_close": "Stäng",
"houseofrc.err_rejected": "House of RC tog inte emot resultatet, inget skrevs: {message}",
"houseofrc.refresh_hint": "Nya anmälningar och avanmälningar sedan racet skapades ({name})",
@@ -4467,6 +4497,17 @@ 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.auto_send": "Send heats automatically",
"houseofrc.auto_send_hint": "After every heat the race controller sends heats and qualifying to House of RC (not the final placings). Without internet it tries again every minute.",
"houseofrc.status_auto_waiting": "Sent after the next heat",
"houseofrc.status_sent_heats": "Sent {time} · heats",
"houseofrc.status_sent_final": "Sent {time} · final results",
"houseofrc.status_failed": "Could not send {time}",
"houseofrc.status_failed_retry": "Waiting to send ({time}) – trying again",
"houseofrc.warn_running": "A heat is running – its result isn't complete yet.",
"houseofrc.warn_finals_left": "Finals not run yet: {names}.",
"houseofrc.warn_missing": "{count} participants have no House of RC entry and are left out.",
"houseofrc.warn_unchanged": "Nothing has changed since the last send.",
"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}",
@@ -4484,7 +4525,6 @@ const TRANSLATIONS = {
"houseofrc.results_send": "Send ({count})",
"houseofrc.results_sending": "Sending …",
"houseofrc.results_sent": "{count} entries updated on House of RC.",
"houseofrc.results_last": "last sent {time}",
"houseofrc.results_close": "Close",
"houseofrc.err_rejected": "House of RC did not accept the results, nothing was written: {message}",
"houseofrc.refresh_hint": "New entries and withdrawals since the race was created ({name})",
@@ -6016,6 +6056,7 @@ async function init() {
setInterval(tickClock, 1000);
updateSyncStatus();
setInterval(updateSyncStatus, 1000);
setInterval(tickHouseOfRcAutoSend, 10000);
document.getElementById("syncStatusRetry")?.addEventListener("click", async () => {
if (backend.pendingWrites) return;
if (localStateDirty || backend.writeError || backend.passingError) {