Bug fix to return 404 for unknown trip.
This commit is contained in:
parent
40bac83790
commit
53f6d05e52
|
@ -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>")
|
||||
|
|
Loading…
Reference in a new issue