Fix account dashboard first-paint rendering

This commit is contained in:
2026-06-11 20:49:48 -04:00
parent 8dc372b8a9
commit 429228bf18
3 changed files with 70 additions and 27 deletions
+37 -12
View File
@@ -1055,8 +1055,16 @@ def local_syncer_save_summary(account_id):
applied_dir = root / "state" / "applied"
paths = {
"us": applied_dir / f"psopeeps_us.site.{account}.json",
"eu": applied_dir / f"psopeeps_eu.site.{account}.json",
"us": [
applied_dir / f"psopeeps_us.us-live.site.{account}.json",
applied_dir / f"psopeeps_us.us-test.site.{account}.json",
applied_dir / f"psopeeps_us.us-hardcore.site.{account}.json",
],
"eu": [
applied_dir / f"psopeeps_eu.eu-live.site.{account}.json",
applied_dir / f"psopeeps_eu.eu-test.site.{account}.json",
applied_dir / f"psopeeps_eu.eu-hardcore.site.{account}.json",
],
}
def parse_time(value):
@@ -1079,19 +1087,36 @@ def local_syncer_save_summary(account_id):
"manifest_sha256": None,
}
if path.exists():
states = []
errors = []
for path in paths[region]:
if not path.exists():
continue
try:
data = json.loads(path.read_text())
info.update({
"status": "seen",
"label": "Seen",
"style": "warn",
"host": data.get("host"),
"applied_at": data.get("applied_at"),
"manifest_sha256": data.get("manifest_sha256"),
})
data["_path"] = str(path)
states.append(data)
except Exception as e:
info["error"] = str(e)
errors.append(f"{path.name}: {e}")
if states:
latest_state = max(states, key=lambda x: str(x.get("applied_at") or ""))
hashes = {x.get("manifest_sha256") for x in states if x.get("manifest_sha256")}
info.update({
"status": "seen",
"label": "Seen",
"style": "warn",
"host": latest_state.get("host"),
"applied_at": latest_state.get("applied_at"),
"manifest_sha256": latest_state.get("manifest_sha256"),
"targets_seen": len(states),
"targets_expected": len(paths[region]),
"all_targets_same_hash": len(hashes) == 1,
})
if errors:
info["errors"] = errors
regions[region] = info