fix(phase26): close BUG-08 Pi trip deletion (verified in prod)

This commit is contained in:
Mathieu Moran
2026-08-11 02:12:40 -04:00
parent c5c478bef6
commit 447d73bbe5
3 changed files with 6 additions and 20 deletions
+5 -19
View File
@@ -158,25 +158,11 @@ the authoritative, issue-by-issue record lives **here**.
---
### BUG-08 — No trip deletion on the local Pi (only on the remote portal)
- **Status**: `OPEN`
- **Severity**: Medium (feature parity: delete trips locally)
- **Area**: Pi `templates/components.html`, `templates/base.html`, `templates/history.html`,
`static/js/history.js`, `app.py`
- **Phase**: Phase 26
- **Symptom**: The Pi `/history` page has no way to delete a trip. The remote portal does.
- **Root cause**: Several Pi pieces are missing compared to the server:
1. Pi `components.html` `data_table` macro lacks the `deletable` arg that emits
`data-deletable="1"` (the server's macro has it).
2. Pi `base.html` does not define `window.confirmDelete` (the server's does).
3. Pi `history.js` hardcodes the **server** delete endpoint
`/api/v1/portal/trip/<id>` — which does not exist on the Pi.
4. There is no `DELETE /api/trip/<id>` route on the Pi at all.
- **Fix scope / actions**: Add all four pieces on the Pi — the `deletable` macro arg, the
`window.confirmDelete` helper, a `DELETE /api/trip/<id>` route that removes only the derived trip
record (keeping the raw `tracking` data), and make the delete endpoint configurable in
`history.js` (e.g. via a data attribute like the tile URL) so the same JS works on Pi and server.
- **Acceptance**: The Pi `/history` page can delete a trip with confirmation; raw GPS data is
preserved; the server portal is unaffected.
- **Status**: `CLOSED` (commit `c5c478b`; deployed + verified 2026-08-11)
- **Fix**: Added `deletable` param to `data_table` macro, `window.confirmDelete` helper in
`base.html`, `DELETE /api/trip/<id>` route + `app_sql.delete_trip()`, and configurable
`data-delete-url` in `history.js` (shared Pi+server). Trip 1967 deleted, 18→17 trips,
2028 tracking rows preserved.
---