Consider railway stations for trip countries
This commit is contained in:
parent
b28d5241c6
commit
2e87d0f120
|
@ -160,13 +160,18 @@ class Trip:
|
||||||
items.append(country)
|
items.append(country)
|
||||||
|
|
||||||
for item in self.travel:
|
for item in self.travel:
|
||||||
if item["type"] != "flight":
|
travel_countries = set()
|
||||||
continue
|
if item["type"] == "flight":
|
||||||
|
for key in "from_airport", "to_airport":
|
||||||
|
c = item[key]["country"]
|
||||||
|
travel_countries.add(c)
|
||||||
|
if item["type"] == "train":
|
||||||
|
for leg in item["legs"]:
|
||||||
|
for key in "from_station", "to_station":
|
||||||
|
c = leg[key]["country"]
|
||||||
|
travel_countries.add(c)
|
||||||
|
|
||||||
for key in "from_airport", "to_airport":
|
for c in travel_countries - seen:
|
||||||
c = item[key]["country"]
|
|
||||||
if c in seen:
|
|
||||||
continue
|
|
||||||
seen.add(c)
|
seen.add(c)
|
||||||
country = agenda.get_country(c)
|
country = agenda.get_country(c)
|
||||||
assert country
|
assert country
|
||||||
|
|
Loading…
Reference in a new issue