feat(mobile): editable activity title for local activities
Adds edits_json column (migration v3) to store user overrides separately from detail_json so Option A server re-extraction never clobbers them. - Tap the title in the detail screen to edit (local activities only, shown with a ✎ hint). Saves on keyboard dismiss via onEndEditing. - Cards and search display user_title ?? title. - Raw upload: user_title sent to server -> sidecar written so web UI shows the correct title (server re-extracts from FIT, which has Karoo's title). - BAS upload: detail.title overridden before sending, no sidecar needed.
This commit is contained in:
@@ -636,6 +636,7 @@ async def upload_raw_activity(
|
||||
body = await request.json()
|
||||
filename_hint: str = body.get("filename") or "activity.fit"
|
||||
b64: str = body.get("base64") or ""
|
||||
user_title: Optional[str] = body.get("user_title") or None
|
||||
if not b64:
|
||||
raise HTTPException(400, "Missing base64 field")
|
||||
|
||||
@@ -691,6 +692,15 @@ async def upload_raw_activity(
|
||||
|
||||
_upsert_index_summary(user_dir, act_id, detail, geojson)
|
||||
|
||||
if user_title:
|
||||
import yaml as _yaml
|
||||
edits_dir = user_dir / "edits"
|
||||
edits_dir.mkdir(parents=True, exist_ok=True)
|
||||
(edits_dir / f"{act_id}.md").write_text(
|
||||
f"---\n{_yaml.dump({'title': user_title}, allow_unicode=True)}---\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
except Exception as exc:
|
||||
log.warning("upload/raw[%s]: extraction failed: %s", user.handle, exc)
|
||||
raise HTTPException(422, f"Could not extract activity: {exc}") from exc
|
||||
|
||||
Reference in New Issue
Block a user