This commit is contained in:
2026-09-18 18:41:57 +03:00
parent 13134d29b5
commit baca1e083c
4 changed files with 140 additions and 40 deletions

View File

@@ -1011,9 +1011,9 @@
renderTournamentList();
}
if (state.selectedId) {
// BUILD145: once per minute refresh the selected date at the source first.
// The service also walks every game on that date and reconciles its score
// from the per-game JSON card before PostgreSQL is read back into Runtime.
// BUILD146: once per minute refresh score and status for every game on the selected date.
// The service walks every game on that date and reconciles both score and
// canonical status from the per-game JSON card before Runtime reads PostgreSQL.
if (!document.hidden && state.gameDate === localDateIso()) {
try {
await refreshSelectedTournamentScheduleCache();
@@ -1469,9 +1469,9 @@
&& !state.gamesAutoSyncAttempted.has(syncKey)
&& !state.scheduleSyncBusy
) {
// BUILD145: always do one quiet authoritative pass when a tournament is
// opened, even when an old schedule cache already exists. The server
// refreshes the XML and then reconciles every game on this date by JSON.
// BUILD146: always do one quiet authoritative pass when a tournament is
// opened. XML refreshes the calendar; every game on this date is then
// reconciled by JSON for score and scheduled/live/finished status.
state.gamesAutoSyncAttempted.add(syncKey);
try {
await refreshSelectedTournamentScheduleCache();
@@ -1672,9 +1672,13 @@ function gameCard(game) {
: "";
const scores = result.score_reconcile || {};
const scoreLabel = Number(scores.checked || 0)
? ` · ${state.language === "en" ? "scores" : "счёт"} ${Number(scores.checked || 0) - Number(scores.failed || 0)}/${Number(scores.checked || 0)}`
? ` · ${state.language === "en" ? "games checked" : "проверено игр"} ${Number(scores.checked || 0) - Number(scores.failed || 0)}/${Number(scores.checked || 0)}`
: "";
notify(`${t("gamesLoaded")}: ${visibleCount} · ${result.endpoint}${fallbackLabel}${scoreLabel}`);
const changedParts = [];
if (Number(scores.score_updated || 0)) changedParts.push(`${state.language === "en" ? "score" : "счёт"}: ${Number(scores.score_updated || 0)}`);
if (Number(scores.status_updated || 0)) changedParts.push(`${state.language === "en" ? "status" : "статус"}: ${Number(scores.status_updated || 0)}`);
const changedLabel = changedParts.length ? ` · ${changedParts.join(", ")}` : "";
notify(`${t("gamesLoaded")}: ${visibleCount} · ${result.endpoint}${fallbackLabel}${scoreLabel}${changedLabel}`);
}
state.gamesAutoSyncAttempted.add(String(state.selectedId));
state.games = await request(gamesUrl());