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
|
||||
|
||||
@property
|
||||
def countries(self) -> set[Country]:
|
||||
"""Trip countries."""
|
||||
found: set[Country] = set()
|
||||
def countries(self) -> list[Country]:
|
||||
"""Countries visited as part of trip, in order."""
|
||||
seen: set[str] = set()
|
||||
items: list[Country] = []
|
||||
for item in self.conferences + self.accommodation:
|
||||
if "country" not in item:
|
||||
continue
|
||||
if item["country"] in seen:
|
||||
continue
|
||||
seen.add(item["country"])
|
||||
country = agenda.get_country(item["country"])
|
||||
assert country
|
||||
found.add(country)
|
||||
items.append(country)
|
||||
|
||||
return found
|
||||
return items
|
||||
|
||||
@property
|
||||
def countries_str(self) -> str:
|
||||
|
|
Loading…
Reference in a new issue