fix: rebuild athlete.json on every ingest; remove bincio-extract references from UI
This commit is contained in:
@@ -59,6 +59,20 @@ def ingest_parsed(
|
|||||||
summaries[activity_id] = summary
|
summaries[activity_id] = summary
|
||||||
write_index(list(summaries.values()), data_dir, owner)
|
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
|
return activity_id
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
<MmpChart {athlete} {activities} />
|
<MmpChart {athlete} {activities} />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<p class="text-zinc-500 text-sm">No power data found. Make sure your activities include power meter data and re-run <code class="text-zinc-300">bincio extract</code>.</p>
|
<p class="text-zinc-500 text-sm">No power data found. Make sure your activities include power meter data.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- Records tab -->
|
<!-- Records tab -->
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ const handle = shards[0]?.handle ?? null;
|
|||||||
window.location.replace(base + 'u/' + handle + '/athlete/');
|
window.location.replace(base + 'u/' + handle + '/athlete/');
|
||||||
</script>
|
</script>
|
||||||
) : (
|
) : (
|
||||||
<p>No data found. Run <code>bincio extract</code> first.</p>
|
<p>No data found. Upload activities to get started.</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ const handle = shards[0]?.handle ?? null;
|
|||||||
window.location.replace(base + 'u/' + handle + '/stats/');
|
window.location.replace(base + 'u/' + handle + '/stats/');
|
||||||
</script>
|
</script>
|
||||||
) : (
|
) : (
|
||||||
<p>No data found. Run <code>bincio extract</code> first.</p>
|
<p>No data found. Upload activities to get started.</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user