Show map of past trips
This commit is contained in:
parent
bd61b1bccd
commit
36b5d38274
4 changed files with 43 additions and 26 deletions
25
web_view.py
25
web_view.py
|
|
@ -170,27 +170,8 @@ def trip_list() -> str:
|
|||
past = [item for item in trip_list if (item.end or item.start) < today]
|
||||
future = [item for item in trip_list if item.start > today]
|
||||
|
||||
future_coordinates = []
|
||||
seen_future_coordinates: set[tuple[str, str]] = set()
|
||||
future_routes = []
|
||||
seen_future_routes: set[str] = set()
|
||||
for trip in future:
|
||||
for stop in agenda.trip.collect_trip_coordinates(trip):
|
||||
key = (stop["type"], stop["name"])
|
||||
if key in seen_future_coordinates:
|
||||
continue
|
||||
future_coordinates.append(stop)
|
||||
seen_future_coordinates.add(key)
|
||||
|
||||
for route in agenda.trip.get_trip_routes(trip):
|
||||
if route["key"] in seen_future_routes:
|
||||
continue
|
||||
future_routes.append(route)
|
||||
seen_future_routes.add(route["key"])
|
||||
|
||||
for route in future_routes:
|
||||
if "geojson_filename" in route:
|
||||
route["geojson"] = agenda.trip.read_geojson(route.pop("geojson_filename"))
|
||||
future_coordinates, future_routes = agenda.trip.get_coordinates_and_routes(future)
|
||||
past_coordinates, past_routes = agenda.trip.get_coordinates_and_routes(past)
|
||||
|
||||
return flask.render_template(
|
||||
"trip_list.html",
|
||||
|
|
@ -199,6 +180,8 @@ def trip_list() -> str:
|
|||
future=future,
|
||||
future_coordinates=future_coordinates,
|
||||
future_routes=future_routes,
|
||||
past_coordinates=past_coordinates,
|
||||
past_routes=past_routes,
|
||||
today=today,
|
||||
get_country=agenda.get_country,
|
||||
format_list_with_ampersand=format_list_with_ampersand,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue