parent
39f9c98a51
commit
3a7784bb25
|
@ -198,7 +198,7 @@ def get_trip_routes(trip: Trip) -> list[StrDict]:
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"type": "flight",
|
"type": "unbooked_flight",
|
||||||
"key": f'LHR_{item["location"]}_{item["country"]}',
|
"key": f'LHR_{item["location"]}_{item["country"]}',
|
||||||
"from": lhr,
|
"from": lhr,
|
||||||
"to": latlon_tuple(item),
|
"to": latlon_tuple(item),
|
||||||
|
|
|
@ -39,14 +39,14 @@ function build_map(map_id, coordinates, routes) {
|
||||||
|
|
||||||
// Draw routes
|
// Draw routes
|
||||||
routes.forEach(function(route) {
|
routes.forEach(function(route) {
|
||||||
var color = {"train": "blue", "flight": "red"}[route.type];
|
var color = {"train": "blue", "flight": "red", "unbooked_flight": "orange"}[route.type];
|
||||||
var style = { weight: 3, opacity: 0.5, color: color };
|
var style = { weight: 3, opacity: 0.5, color: color };
|
||||||
if (route.geojson) {
|
if (route.geojson) {
|
||||||
// If route is defined as GeoJSON
|
// If route is defined as GeoJSON
|
||||||
L.geoJSON(JSON.parse(route.geojson), {
|
L.geoJSON(JSON.parse(route.geojson), {
|
||||||
style: function(feature) { return style; }
|
style: function(feature) { return style; }
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
} else if (route.type === "flight") {
|
} else if (route.type === "flight" || route.type === "unbooked_flight") {
|
||||||
var flightPath = new L.Geodesic([[route.from, route.to]], style).addTo(map);
|
var flightPath = new L.Geodesic([[route.from, route.to]], style).addTo(map);
|
||||||
} else {
|
} else {
|
||||||
// If route is defined by 'from' and 'to' coordinates
|
// If route is defined by 'from' and 'to' coordinates
|
||||||
|
|
|
@ -233,7 +233,7 @@ def trip_page(start: str) -> str:
|
||||||
|
|
||||||
coordinates = agenda.trip.collect_trip_coordinates(trip)
|
coordinates = agenda.trip.collect_trip_coordinates(trip)
|
||||||
routes = agenda.trip.get_trip_routes(trip)
|
routes = agenda.trip.get_trip_routes(trip)
|
||||||
if any(route["type"] == "flight" for route in routes) and not any(
|
if any(route["type"] == "unbooked_flight" for route in routes) and not any(
|
||||||
pin["type"] == "airport" for pin in coordinates
|
pin["type"] == "airport" for pin in coordinates
|
||||||
):
|
):
|
||||||
airports = typing.cast(
|
airports = typing.cast(
|
||||||
|
|
Loading…
Reference in a new issue