diff --git a/bincio/extract/ingest.py b/bincio/extract/ingest.py index 7515251..dedb4fc 100644 --- a/bincio/extract/ingest.py +++ b/bincio/extract/ingest.py @@ -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 diff --git a/site/src/components/AthleteView.svelte b/site/src/components/AthleteView.svelte index 3de95cd..ed990f1 100644 --- a/site/src/components/AthleteView.svelte +++ b/site/src/components/AthleteView.svelte @@ -130,7 +130,7 @@ {:else} -

No power data found. Make sure your activities include power meter data and re-run bincio extract.

+

No power data found. Make sure your activities include power meter data.

{/if} diff --git a/site/src/pages/athlete/index.astro b/site/src/pages/athlete/index.astro index 58865d5..3f56408 100644 --- a/site/src/pages/athlete/index.astro +++ b/site/src/pages/athlete/index.astro @@ -13,5 +13,5 @@ const handle = shards[0]?.handle ?? null; window.location.replace(base + 'u/' + handle + '/athlete/'); ) : ( -

No data found. Run bincio extract first.

+

No data found. Upload activities to get started.

)} diff --git a/site/src/pages/stats/index.astro b/site/src/pages/stats/index.astro index b2ceda2..65bcf96 100644 --- a/site/src/pages/stats/index.astro +++ b/site/src/pages/stats/index.astro @@ -14,5 +14,5 @@ const handle = shards[0]?.handle ?? null; window.location.replace(base + 'u/' + handle + '/stats/'); ) : ( -

No data found. Run bincio extract first.

+

No data found. Upload activities to get started.

)}