parent
36b5d38274
commit
fbee775f5b
3 changed files with 19 additions and 3 deletions
11
web_view.py
11
web_view.py
|
|
@ -191,10 +191,15 @@ def trip_list() -> str:
|
|||
@app.route("/trip/<start>")
|
||||
def trip_page(start: str) -> str:
|
||||
"""Individual trip page."""
|
||||
trip_list = agenda.trip.build_trip_list()
|
||||
trip_iter = iter(agenda.trip.build_trip_list())
|
||||
today = date.today()
|
||||
|
||||
trip = next((trip for trip in trip_list if trip.start.isoformat() == start), None)
|
||||
prev_trip = None
|
||||
for trip in trip_iter:
|
||||
if trip.start.isoformat() == start:
|
||||
break
|
||||
prev_trip = trip
|
||||
next_trip = next(trip_iter, None)
|
||||
|
||||
if not trip:
|
||||
flask.abort(404)
|
||||
|
|
@ -208,6 +213,8 @@ def trip_page(start: str) -> str:
|
|||
return flask.render_template(
|
||||
"trip_page.html",
|
||||
trip=trip,
|
||||
prev_trip=prev_trip,
|
||||
next_trip=next_trip,
|
||||
today=today,
|
||||
coordinates=coordinates,
|
||||
routes=routes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue