Show trip country list in order visited
This commit is contained in:
parent
fd6d3b674b
commit
50127417f0
|
@ -55,17 +55,21 @@ class Trip:
|
||||||
return max_date if max_date != date.min else None
|
return max_date if max_date != date.min else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def countries(self) -> set[Country]:
|
def countries(self) -> list[Country]:
|
||||||
"""Trip countries."""
|
"""Countries visited as part of trip, in order."""
|
||||||
found: set[Country] = set()
|
seen: set[str] = set()
|
||||||
|
items: list[Country] = []
|
||||||
for item in self.conferences + self.accommodation:
|
for item in self.conferences + self.accommodation:
|
||||||
if "country" not in item:
|
if "country" not in item:
|
||||||
continue
|
continue
|
||||||
|
if item["country"] in seen:
|
||||||
|
continue
|
||||||
|
seen.add(item["country"])
|
||||||
country = agenda.get_country(item["country"])
|
country = agenda.get_country(item["country"])
|
||||||
assert country
|
assert country
|
||||||
found.add(country)
|
items.append(country)
|
||||||
|
|
||||||
return found
|
return items
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def countries_str(self) -> str:
|
def countries_str(self) -> str:
|
||||||
|
|
Loading…
Reference in a new issue