diff --git a/agenda/trip.py b/agenda/trip.py index cbb72fc..b0c50cf 100644 --- a/agenda/trip.py +++ b/agenda/trip.py @@ -93,6 +93,7 @@ def load_flight_bookings(data_dir: str) -> list[StrDict]: """Load flight bookings.""" bookings = load_travel("flight", "flights", data_dir) airlines = yaml.safe_load(open(os.path.join(data_dir, "airlines.yaml"))) + iata = {a["iata"]: a["name"] for a in airlines} airports = travel.parse_yaml("airports", data_dir) for booking in bookings: for flight in booking["flights"]: @@ -101,7 +102,7 @@ def load_flight_bookings(data_dir: str) -> list[StrDict]: if flight["to"] in airports: flight["to_airport"] = airports[flight["to"]] if "airline" in flight: - flight["airline_name"] = airlines.get(flight["airline"], "[unknown]") + flight["airline_name"] = iata.get(flight["airline"], "[unknown]") flight["distance"] = travel.flight_distance(flight) return bookings