Show unbooked flights in orange

Closes: #114
This commit is contained in:
Edward Betts 2024-01-16 17:11:55 +00:00
parent 39f9c98a51
commit 3a7784bb25
3 changed files with 4 additions and 4 deletions

View file

@ -198,7 +198,7 @@ def get_trip_routes(trip: Trip) -> list[StrDict]:
return [
{
"type": "flight",
"type": "unbooked_flight",
"key": f'LHR_{item["location"]}_{item["country"]}',
"from": lhr,
"to": latlon_tuple(item),

View file

@ -39,14 +39,14 @@ function build_map(map_id, coordinates, routes) {
// Draw routes
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 };
if (route.geojson) {
// If route is defined as GeoJSON
L.geoJSON(JSON.parse(route.geojson), {
style: function(feature) { return style; }
}).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);
} else {
// If route is defined by 'from' and 'to' coordinates

View file

@ -233,7 +233,7 @@ def trip_page(start: str) -> str:
coordinates = agenda.trip.collect_trip_coordinates(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
):
airports = typing.cast(