Records: exclude Zwift activities by title; show Saved confirmation before closing drawer
- _is_outdoor now also excludes activities whose title matches /\bzwift\b/i, covering the ~50 Strava-imported Zwift rides that lack sub_sport metadata. - EditDrawer waits 900ms after a successful save before dispatching 'saved' (which closes the drawer), so the green "Saved" confirmation is visible.
This commit is contained in:
@@ -278,9 +278,14 @@ def write_athlete_json(summaries: list[dict], output_dir: Path, athlete_config:
|
|||||||
return [[d, w] for d, w in sorted(best.items())]
|
return [[d, w] for d, w in sorted(best.items())]
|
||||||
|
|
||||||
_INDOOR_SUB_SPORTS = {"indoor", "treadmill", "virtual"}
|
_INDOOR_SUB_SPORTS = {"indoor", "treadmill", "virtual"}
|
||||||
|
_INDOOR_TITLE_RE = re.compile(r'\bzwift\b', re.IGNORECASE)
|
||||||
|
|
||||||
def _is_outdoor(s: dict) -> bool:
|
def _is_outdoor(s: dict) -> bool:
|
||||||
return s.get("sub_sport") not in _INDOOR_SUB_SPORTS
|
if s.get("sub_sport") in _INDOOR_SUB_SPORTS:
|
||||||
|
return False
|
||||||
|
if _INDOOR_TITLE_RE.search(s.get("title") or ""):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
all_mmps = [s["mmp"] for s in summaries if s.get("mmp") and _is_outdoor(s)]
|
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_365 = [s["mmp"] for s in summaries if s.get("mmp") and _is_outdoor(s) and s["started_at"] >= cutoff_365]
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
if (!res.ok) throw new Error(await res.text());
|
if (!res.ok) throw new Error(await res.text());
|
||||||
saveStatus = 'Saved';
|
saveStatus = 'Saved';
|
||||||
saveOk = true;
|
saveOk = true;
|
||||||
|
await new Promise(r => setTimeout(r, 900));
|
||||||
dispatch('saved', { title, description });
|
dispatch('saved', { title, description });
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
saveStatus = e.message;
|
saveStatus = e.message;
|
||||||
|
|||||||
Reference in New Issue
Block a user