diff --git a/FEATURES.md b/FEATURES.md index 01a5ae4..79265fe 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -159,3 +159,13 @@ dedicated PLAN.md phase (or fold it into the relevant existing work) and mark it (No entries yet — shipped features land here. Keep the original idea text intact and add the shipped phase/date.) + +### FEAT-06 — Trip ID column in history table +- **Status**: `SHIPPED` 2026-08-11 +- **Area**: `static/js/history.js`, `templates/history.html`, `server/templates/history.html` +- **Phase**: Phase 26 (slipped in during bug-fix pass) +- **What**: A narrow `#ID` column appears at the left of every trip row on both Pi and server + history pages, showing the database trip ID (e.g. `#18517`). Useful for debugging and + cross-referencing trips between Pi and server. +- **Implementation**: `history.js` render function prepends a `` with the ID. Both Pi and + server templates add `{"key": "id", "label": "ID", "sortable": false}` to the column list. diff --git a/server/templates/history.html b/server/templates/history.html index fce020e..30a47b2 100644 --- a/server/templates/history.html +++ b/server/templates/history.html @@ -29,6 +29,7 @@ {{ data_table( "trip-list", [ + {"key": "id", "label": "ID", "sortable": false}, {"key": "started", "label": "Started", "sortable": true}, {"key": "distance", "label": "km", "sortable": true}, {"key": "duration", "label": "Time", "sortable": true}, diff --git a/static/js/history.js b/static/js/history.js index 6bc53e3..f41c7d9 100644 --- a/static/js/history.js +++ b/static/js/history.js @@ -229,7 +229,7 @@ row.dataset.tripId = t.id; row.style.cursor = "pointer"; var db = del ? '' : ""; var cb = bUrl ? '' : ""; - row.innerHTML = cb + "" + fT(t.start_datetime) + "" + fK(t.distance_km) + "" + fD(t.duration_seconds) + "" + fS(t.max_speed_kmh) + "" + (t.odo_start_km != null ? t.odo_start_km.toFixed(0) + " \u2192 " + t.odo_end_km.toFixed(0) + " km" : "\u2014") + "" + db + ""; + row.innerHTML = cb + "#" + t.id + "" + fT(t.start_datetime) + "" + fK(t.distance_km) + "" + fD(t.duration_seconds) + "" + fS(t.max_speed_kmh) + "" + (t.odo_start_km != null ? t.odo_start_km.toFixed(0) + " \u2192 " + t.odo_end_km.toFixed(0) + " km" : "\u2014") + "" + db + ""; body.appendChild(row); }); body.querySelectorAll("input.trip-checkbox").forEach(function (c) { c.addEventListener("change", upBt); }); diff --git a/templates/history.html b/templates/history.html index 0567957..078585b 100644 --- a/templates/history.html +++ b/templates/history.html @@ -27,6 +27,7 @@ {{ data_table( "trip-list", [ + {"key": "id", "label": "ID", "sortable": false}, {"key": "started", "label": "Started", "sortable": true}, {"key": "distance", "label": "km", "sortable": true}, {"key": "duration", "label": "Time", "sortable": true},