admin: add Total imported and Last sync columns to Garmin sync table

Matches the Strava sync table layout. Accumulates total_imported in
garmin_sync.json state on each sync run; admin API exposes last_sync_at
and total_imported from that file.
This commit is contained in:
Davide Scaini
2026-05-21 20:32:54 +02:00
parent 418e3a13e8
commit d4e5b11f71
3 changed files with 22 additions and 6 deletions
+13
View File
@@ -607,6 +607,17 @@ async def admin_garmin_sync_status(
user_dir = cf.parent
handle = user_dir.name
last_sync: str | None = None
total_imported = 0
sync_path = user_dir / "garmin_sync.json"
if sync_path.exists():
try:
sc = json.loads(sync_path.read_text(encoding="utf-8"))
last_sync = sc.get("last_sync_at")
total_imported = sc.get("total_imported", 0)
except (OSError, json.JSONDecodeError):
pass
run_status: str | None = None
run_imported = 0
run_errors = 0
@@ -626,6 +637,8 @@ async def admin_garmin_sync_status(
users.append({
"handle": handle,
"last_sync": last_sync,
"total_imported": total_imported,
"run_status": run_status,
"run_imported": run_imported,
"run_errors": run_errors,