Skip to content

Commit 9ad0ce8

Browse files
committed
DBC22-6513: fix camera list south-to-north highway ordering
Reverse Hwy 19/19A/99A route geometries so cameras sort south to north, and compare route_order numerically in the camera list.
1 parent 417af85 commit 9ad0ce8

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/backend/apps/webcam/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ def build_route_geometries(coords=hwy_coords):
520520
points_list = [Point(p) for p in response.json()['route']]
521521
ls_routes.append(LineString(points_list))
522522

523-
# DBC22-2456
523+
# DBC22-2456 / DBC22-6513: reverse so camera order is south→north (and west→east)
524524
highways_to_reverse = [
525-
'2', '3B', '9', '11', '13', '15', '17A', '23',
525+
'2', '3B', '9', '11', '13', '15', '17A', '19', '19A', '23',
526526
'27', '29', '31', '33', '35', '37', '43', '91A',
527-
'93', '95', '97', '97C'
527+
'93', '95', '97', '97C', '99A'
528528
]
529529

530530
if key in highways_to_reverse:

src/frontend/src/pages/CamerasListPage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ export default function CamerasListPage() {
222222
} else {
223223
const highwayCompare = collator.compare(a.highway_display, b.highway_display);
224224
if (highwayCompare == 0) {
225-
return collator.compare(a.route_order, b.route_order);
225+
// Numeric compare — Collator stringifies null/undefined unpredictably
226+
return (a.route_order ?? Number.MAX_SAFE_INTEGER) - (b.route_order ?? Number.MAX_SAFE_INTEGER);
226227
}
227228

228229
return highwayCompare;

src/frontend/src/pages/SavedCamerasPage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export default function SavedCamerasPage() {
116116
// Sort by highway first, then default highway/route order
117117
const highwayCompare = collator.compare(a.highway_display, b.highway_display);
118118
if (highwayCompare == 0) {
119-
return collator.compare(a.route_order, b.route_order);
119+
// Numeric compare — Collator stringifies null/undefined unpredictably
120+
return (a.route_order ?? Number.MAX_SAFE_INTEGER) - (b.route_order ?? Number.MAX_SAFE_INTEGER);
120121
}
121122

122123
return highwayCompare;

0 commit comments

Comments
 (0)