From 53f6d05e527d767fadc980d1bd3a178ccbb17338 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 13 Nov 2024 14:36:49 +0000 Subject: [PATCH] Bug fix to return 404 for unknown trip. --- web_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web_view.py b/web_view.py index fb65c7b..7f6f555 100755 --- a/web_view.py +++ b/web_view.py @@ -486,13 +486,15 @@ def get_prev_current_and_next_trip( """Get previous trip, this trip and next trip.""" trip_iter = iter(trip_list) prev_trip = None + current_trip = None for trip in trip_iter: if trip.start.isoformat() == start: + current_trip = trip break prev_trip = trip next_trip = next(trip_iter, None) - return (prev_trip, trip, next_trip) + return (prev_trip, current_trip, next_trip) @app.route("/trip/")