Exclude indoor/virtual activities from records and power curve

This commit is contained in:
Davide Scaini
2026-05-13 16:05:26 +02:00
parent 2395a6e566
commit c837464a28
+8 -3
View File
@@ -277,9 +277,12 @@ def write_athlete_json(summaries: list[dict], output_dir: Path, athlete_config:
best[d] = w best[d] = w
return [[d, w] for d, w in sorted(best.items())] return [[d, w] for d, w in sorted(best.items())]
all_mmps = [s["mmp"] for s in summaries if s.get("mmp")] def _is_outdoor(s: dict) -> bool:
mmps_365 = [s["mmp"] for s in summaries if s.get("mmp") and s["started_at"] >= cutoff_365] return s.get("sub_sport") != "indoor"
mmps_90 = [s["mmp"] for s in summaries if s.get("mmp") and s["started_at"] >= cutoff_90]
all_mmps = [s["mmp"] for s in summaries if s.get("mmp") and _is_outdoor(s)]
mmps_365 = [s["mmp"] for s in summaries if s.get("mmp") and _is_outdoor(s) and s["started_at"] >= cutoff_365]
mmps_90 = [s["mmp"] for s in summaries if s.get("mmp") and _is_outdoor(s) and s["started_at"] >= cutoff_90]
# ── Personal records aggregation ────────────────────────────────────────── # ── Personal records aggregation ──────────────────────────────────────────
# records[sport][distance_km] = {time_s, activity_id, started_at, title} # records[sport][distance_km] = {time_s, activity_id, started_at, title}
@@ -290,6 +293,8 @@ def write_athlete_json(summaries: list[dict], output_dir: Path, athlete_config:
best_climb: list[dict] = [] # top 10 best climbs for cycling best_climb: list[dict] = [] # top 10 best climbs for cycling
for s in summaries: for s in summaries:
if not _is_outdoor(s):
continue
sport = s.get("sport", "other") sport = s.get("sport", "other")
act_id = s.get("id", "") act_id = s.get("id", "")
started = s.get("started_at", "") started = s.get("started_at", "")