fix(gps-tracks): rename health fields and fix layer insert priority (F-04, F-05)
F-04: rename gps_health() response fields per tester feedback: - total_tracks → tracks_total - by_activity → tracks_by_activity - recent_pipeline_runs (list) → last_pipeline_run (object | null) Change LIMIT from 10 to 1; fetch single row instead of a list. F-05: rewrite _findGpsInsertPosition with explicit priority order: 1. gpx-layer-* (ET-006 GPX file layers) — highest priority 2. route-* (ET-002 routing layers) Remove old combined find() that lacked clear priority semantics. Add tests/web/gps_tracks.test.js (22 JS unit tests via node:test): - _findGpsInsertPosition priority logic (9 cases) - Filter state management — default state assertions (5 cases) - Color palette mapping and _buildColorExpression (8 cases) Add tests/web/test_gps_tracks.py — Python pytest runner (8 static checks + node --test invocation). Refs: ET-008 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -224,10 +224,11 @@ def create_gps_router(db_path: str) -> APIRouter:
|
||||
status, tracks_new, tracks_updated
|
||||
FROM pipeline_runs
|
||||
ORDER BY started_at DESC
|
||||
LIMIT 10
|
||||
LIMIT 1
|
||||
"""
|
||||
)
|
||||
recent_runs = [dict(row) for row in cur.fetchall()]
|
||||
last_run_row = cur.fetchone()
|
||||
last_run = dict(last_run_row) if last_run_row else None
|
||||
|
||||
cur.execute("SELECT sources_json FROM tracks")
|
||||
tracks_by_source: dict = {}
|
||||
@@ -252,9 +253,9 @@ def create_gps_router(db_path: str) -> APIRouter:
|
||||
return {
|
||||
"status": "ok",
|
||||
"db_path": db_path,
|
||||
"total_tracks": total_tracks,
|
||||
"by_activity": by_activity,
|
||||
"recent_pipeline_runs": recent_runs,
|
||||
"tracks_total": total_tracks,
|
||||
"tracks_by_activity": by_activity,
|
||||
"last_pipeline_run": last_run,
|
||||
"db_size_mb": db_size_mb,
|
||||
"tracks_by_source": tracks_by_source,
|
||||
"tile_cache_size": len(_gps_tile_cache),
|
||||
|
||||
Reference in New Issue
Block a user