Add more flags on trip list

This commit is contained in:
Edward Betts 2024-05-19 13:33:04 +02:00
parent 1948ab8ff5
commit 5758d3f1d0

View file

@ -241,7 +241,13 @@ class Trip:
)
if item["type"] == "train":
for leg in item["legs"]:
name = f"{leg['from']}{leg['to']}"
from_country = agenda.get_country(leg["from_station"]["country"])
to_country = agenda.get_country(leg["to_station"]["country"])
assert from_country and to_country
from_flag = from_country.flag
to_flag = to_country.flag
name = f"{leg['from']} {from_flag}{leg['to']} {to_flag}"
elements.append(
TripElement(
when=leg["depart"],
@ -251,7 +257,14 @@ class Trip:
)
)
if item["type"] == "ferry":
name = f"{item['from']}{item['to']}"
from_country = agenda.get_country(item["from_terminal"]["country"])
to_country = agenda.get_country(item["to_terminal"]["country"])
assert from_country and to_country
from_flag = from_country.flag
to_flag = to_country.flag
name = f"{item['from']} {from_flag}{item['to']} {to_flag}"
elements.append(
TripElement(
when=item["depart"],