Replay route order on device

This commit is contained in:
firestarsdog
2026-10-14 16:32:57 -04:00
parent b94d068a90
commit 39bba541c0
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -353,7 +353,7 @@ class ReplayPage(Widget):
if self.route_source is not owner.routes:
self.route_source = owner.routes
rows = []
for route in reversed(owner.routes):
for route in sorted(owner.routes, key=lambda route: route.get('startTime') or route.get('fileTime') or 0, reverse=True):
calendar, clock, _, source = route_date(route, self.profile, self.clock24_hour)
identifier = route['routeId']
name = route.get('displayName') or identifier
@@ -67,10 +67,13 @@ def test_route_rows_prioritize_dates_preserve_names_and_keep_route_identity(utc,
def test_route_rows_show_newest_first_without_reordering_catalog(profile):
page, owner = page_for_input()
page.profile = profile
owner.routes = [{**ROUTE, 'routeId': f'{number:08d}--0123456789'} for number in (1, 2, 3)]
owner.routes = [{**ROUTE, 'routeId': '00000001--0123456789', 'startTime': STAMP, 'fileTime': STAMP + 120},
{**ROUTE, 'routeId': '00000002--0123456789', 'startTime': STAMP + 60},
{**ROUTE, 'routeId': '00000003--0123456789', 'fileTime': STAMP - 60},
{**ROUTE, 'routeId': '00000004--0123456789'}]
identifiers = [route['routeId'] for route in owner.routes]
rows = page._rows()
assert [row.key for row in rows] == identifiers[::-1]
assert [row.key for row in rows] == [identifiers[1], identifiers[0], identifiers[2], identifiers[3]]
assert [route['routeId'] for route in owner.routes] == identifiers
assert page._rows() is rows