diff --git a/agenda/trip.py b/agenda/trip.py index 6bc4a7d..a306bee 100644 --- a/agenda/trip.py +++ b/agenda/trip.py @@ -143,38 +143,42 @@ def get_trip_routes(trip: Trip) -> list[StrDict]: if "from_airport" not in t or "to_airport" not in t: continue fly_from, fly_to = t["from_airport"], t["to_airport"] + key = "_".join(["flight"] + sorted([fly_from["iata"], fly_to["iata"]])) routes.append( { "type": "flight", + "key": key, "from": latlon_tuple(fly_from), "to": latlon_tuple(fly_to), } ) - - else: - assert t["type"] == "train" - for leg in t["legs"]: - train_from, train_to = leg["from_station"], leg["to_station"] - geojson_filename = train_from.get("routes", {}).get(train_to["uic"]) - if not geojson_filename: - routes.append( - { - "type": "train", - "from": latlon_tuple(train_from), - "to": latlon_tuple(train_to), - } - ) - continue - - if geojson_filename in seen_geojson: - continue - seen_geojson.add(geojson_filename) - + continue + assert t["type"] == "train" + for leg in t["legs"]: + train_from, train_to = leg["from_station"], leg["to_station"] + geojson_filename = train_from.get("routes", {}).get(train_to["uic"]) + key = "_".join(["train"] + sorted([train_from["name"], train_to["name"]])) + if not geojson_filename: routes.append( { "type": "train", - "geojson": read_geojson(geojson_filename), + "key": key, + "from": latlon_tuple(train_from), + "to": latlon_tuple(train_to), } ) + continue + + if geojson_filename in seen_geojson: + continue + seen_geojson.add(geojson_filename) + + routes.append( + { + "type": "train", + "key": key, + "geojson_filename": geojson_filename, + } + ) return routes diff --git a/templates/trips.html b/templates/trips.html index 7da70cb..d0f5624 100644 --- a/templates/trips.html +++ b/templates/trips.html @@ -5,6 +5,11 @@ {% set row = { "flight": flight_row, "train": train_row } %} {% block style %} + + + {% set conference_column_count = 6 %} {% set accommodation_column_count = 7 %} {% set travel_column_count = 7 %} @@ -33,6 +38,13 @@ .grid-item { /* Additional styling for grid items can go here */ } + +#map { + height: 80vh; +} + + + {% endblock %} @@ -79,11 +91,69 @@ {% block content %}