Bug fix to return 404 for unknown trip.

This commit is contained in:
Edward Betts 2024-11-13 14:36:49 +00:00
parent 40bac83790
commit 53f6d05e52

View file

@ -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/<start>")