Compare commits
2 commits
82de51109f
...
ad47f291f8
Author | SHA1 | Date | |
---|---|---|---|
Edward Betts | ad47f291f8 | ||
Edward Betts | 8504a3a022 |
|
@ -29,13 +29,17 @@ class Trip:
|
||||||
travel: list[StrDict] = field(default_factory=list)
|
travel: list[StrDict] = field(default_factory=list)
|
||||||
accommodation: list[StrDict] = field(default_factory=list)
|
accommodation: list[StrDict] = field(default_factory=list)
|
||||||
conferences: list[StrDict] = field(default_factory=list)
|
conferences: list[StrDict] = field(default_factory=list)
|
||||||
|
events: list[StrDict] = field(default_factory=list)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def title(self) -> str:
|
def title(self) -> str:
|
||||||
"""Trip title."""
|
"""Trip title."""
|
||||||
return (
|
return (
|
||||||
format_list_with_ampersand([conf["name"] for conf in self.conferences])
|
format_list_with_ampersand(
|
||||||
or "[no conference]"
|
[conf["name"] for conf in self.conferences]
|
||||||
|
+ [event["title"] for event in self.events]
|
||||||
|
)
|
||||||
|
or "[unnamed trip]"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -60,7 +64,7 @@ class Trip:
|
||||||
"""Countries visited as part of trip, in order."""
|
"""Countries visited as part of trip, in order."""
|
||||||
seen: set[str] = set()
|
seen: set[str] = set()
|
||||||
items: list[Country] = []
|
items: list[Country] = []
|
||||||
for item in self.conferences + self.accommodation:
|
for item in self.conferences + self.accommodation + self.events:
|
||||||
if "country" not in item:
|
if "country" not in item:
|
||||||
continue
|
continue
|
||||||
if item["country"] in seen:
|
if item["country"] in seen:
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro flight_row(item) %}
|
{% macro flight_row(item) %}
|
||||||
|
{% set full_flight_number = item.airline + item.flight_number %}
|
||||||
|
{% set url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
|
||||||
<div class="grid-item text-end">{{ item.depart.strftime("%a, %d %b %Y") }}</div>
|
<div class="grid-item text-end">{{ item.depart.strftime("%a, %d %b %Y") }}</div>
|
||||||
<div class="grid-item">{{ item.from }} → {{ item.to }}</div>
|
<div class="grid-item">{{ item.from }} → {{ item.to }}</div>
|
||||||
<div class="grid-item">{{ item.depart.strftime("%H:%M") }}</div>
|
<div class="grid-item">{{ item.depart.strftime("%H:%M") }}</div>
|
||||||
|
@ -78,7 +80,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-item">{{ item.duration }}</div>
|
<div class="grid-item">{{ item.duration }}</div>
|
||||||
<div class="grid-item">{{ item.airline }}{{ item.flight_number }}</div>
|
<div class="grid-item">
|
||||||
|
<a href="{{ url }}">{{ full_flight_number }}</a>
|
||||||
|
</div>
|
||||||
<div class="grid-item">{{ item.booking_reference }}</div>
|
<div class="grid-item">{{ item.booking_reference }}</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@ def build_trip_list() -> list[Trip]:
|
||||||
"travel": travel_items,
|
"travel": travel_items,
|
||||||
"accommodation": travel.parse_yaml("accommodation", data_dir),
|
"accommodation": travel.parse_yaml("accommodation", data_dir),
|
||||||
"conferences": travel.parse_yaml("conferences", data_dir),
|
"conferences": travel.parse_yaml("conferences", data_dir),
|
||||||
|
"events": travel.parse_yaml("events", data_dir),
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, item_list in data.items():
|
for key, item_list in data.items():
|
||||||
|
|
Loading…
Reference in a new issue