Consider accommodation for trip end date

This commit is contained in:
Edward Betts 2024-01-23 15:56:23 +00:00
parent 72e7945fbe
commit 6475692db1

View file

@ -56,7 +56,14 @@ class Trip:
travel_end = max(arrive) if arrive else datetime.date.min
assert isinstance(travel_end, datetime.date)
max_date = max(max_conference_end, travel_end)
accommodation_end = (
max(as_date(item["to"]) for item in self.accommodation)
if self.accommodation
else datetime.date.min
)
assert isinstance(accommodation_end, datetime.date)
max_date = max(max_conference_end, travel_end, accommodation_end)
return max_date if max_date != datetime.date.min else None
@property