Add events to trips
This commit is contained in:
parent
8504a3a022
commit
ad47f291f8
|
@ -29,13 +29,17 @@ class Trip:
|
|||
travel: list[StrDict] = field(default_factory=list)
|
||||
accommodation: list[StrDict] = field(default_factory=list)
|
||||
conferences: list[StrDict] = field(default_factory=list)
|
||||
events: list[StrDict] = field(default_factory=list)
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
"""Trip title."""
|
||||
return (
|
||||
format_list_with_ampersand([conf["name"] for conf in self.conferences])
|
||||
or "[no conference]"
|
||||
format_list_with_ampersand(
|
||||
[conf["name"] for conf in self.conferences]
|
||||
+ [event["title"] for event in self.events]
|
||||
)
|
||||
or "[unnamed trip]"
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -60,7 +64,7 @@ class Trip:
|
|||
"""Countries visited as part of trip, in order."""
|
||||
seen: set[str] = set()
|
||||
items: list[Country] = []
|
||||
for item in self.conferences + self.accommodation:
|
||||
for item in self.conferences + self.accommodation + self.events:
|
||||
if "country" not in item:
|
||||
continue
|
||||
if item["country"] in seen:
|
||||
|
|
|
@ -178,6 +178,7 @@ def build_trip_list() -> list[Trip]:
|
|||
"travel": travel_items,
|
||||
"accommodation": travel.parse_yaml("accommodation", data_dir),
|
||||
"conferences": travel.parse_yaml("conferences", data_dir),
|
||||
"events": travel.parse_yaml("events", data_dir),
|
||||
}
|
||||
|
||||
for key, item_list in data.items():
|
||||
|
|
Loading…
Reference in a new issue