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:
@@ -189,14 +189,25 @@ function _ensureGpsLayers(map) {
|
||||
}
|
||||
|
||||
function _findGpsInsertPosition(map) {
|
||||
/**
|
||||
* Returns the id of the first layer that GPS tracks should be inserted
|
||||
* below, using priority order:
|
||||
* 1. gpx-layer-* — ET-006 GPX file layers (highest priority)
|
||||
* 2. route-* — ET-002 routing layers
|
||||
* Returns undefined if neither is present (GPS tracks go on top).
|
||||
*/
|
||||
const style = map.getStyle && map.getStyle();
|
||||
if (!style || !style.layers) return undefined;
|
||||
const routeLayer = style.layers.find(l =>
|
||||
l.id === 'route-line' ||
|
||||
l.id.startsWith('route-') ||
|
||||
l.id.startsWith('gpx-layer-')
|
||||
);
|
||||
return routeLayer ? routeLayer.id : undefined;
|
||||
|
||||
// Priority 1: gpx-layer-* (ET-006 GPX file layers)
|
||||
const gpxLayer = style.layers.find(l => l.id.startsWith('gpx-layer-'));
|
||||
if (gpxLayer) return gpxLayer.id;
|
||||
|
||||
// Priority 2: route-* (ET-002 routing layers)
|
||||
const routeLayer = style.layers.find(l => l.id.startsWith('route-'));
|
||||
if (routeLayer) return routeLayer.id;
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// ─── Управление видимостью ────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user