fix: rebuild athlete.json on every ingest; remove bincio-extract references from UI

This commit is contained in:
Davide Scaini
2026-04-10 15:47:50 +02:00
parent f8e02f3da2
commit ae883a7dba
4 changed files with 17 additions and 3 deletions
+14
View File
@@ -59,6 +59,20 @@ def ingest_parsed(
summaries[activity_id] = summary
write_index(list(summaries.values()), data_dir, owner)
# Rebuild athlete.json with updated MMP curves and records.
# Preserve any manually-set fields (max_hr, ftp_w, zones, etc.) from the existing file.
from bincio.extract.writer import write_athlete_json
_COMPUTED = {"bas_version", "generated_at", "power_curve", "records", "best_climbs"}
athlete_config: dict[str, Any] = {}
athlete_path = data_dir / "athlete.json"
if athlete_path.exists():
try:
existing = json.loads(athlete_path.read_text(encoding="utf-8"))
athlete_config = {k: v for k, v in existing.items() if k not in _COMPUTED}
except Exception:
pass
write_athlete_json(list(summaries.values()), data_dir, athlete_config)
return activity_id