Add sub_sport editing to activity edit drawer
This commit is contained in:
@@ -13,7 +13,10 @@ from typing import Any, Optional
|
||||
|
||||
# ── Shared constants (imported by edit/server.py and serve/server.py) ─────────
|
||||
|
||||
from bincio.extract.sport import SUB_SPORTS as _SUB_SPORTS
|
||||
|
||||
SPORTS = ["cycling", "running", "hiking", "walking", "swimming", "skiing", "other"]
|
||||
_VALID_SUB_SPORTS = {v for vs in _SUB_SPORTS.values() for v in vs}
|
||||
STAT_PANELS = ["elevation", "speed", "heart_rate", "cadence", "power"]
|
||||
VALID_ACTIVITY_ID = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9\-]{0,250}$')
|
||||
|
||||
@@ -36,6 +39,8 @@ def apply_sidecar_edit(activity_id: str, payload: dict[str, Any], data_dir: Path
|
||||
lines.append(f"title: {json.dumps(payload['title'])}")
|
||||
if payload.get("sport") and payload["sport"] in SPORTS and payload["sport"] != "other":
|
||||
lines.append(f"sport: {payload['sport']}")
|
||||
if payload.get("sub_sport") and payload["sub_sport"] in _VALID_SUB_SPORTS:
|
||||
lines.append(f"sub_sport: {payload['sub_sport']}")
|
||||
if payload.get("gear"):
|
||||
lines.append(f"gear: {json.dumps(payload['gear'])}")
|
||||
if payload.get("highlight"):
|
||||
|
||||
Reference in New Issue
Block a user