Handle short European trips with rail/ferry returns

When traveling to nearby European countries by rail or ferry,
return journeys often aren't recorded in flight/accommodation
data. Added logic to assume you've returned home after short
European trips that ended >3 days ago.

Covers common rail/ferry destinations: Belgium, Netherlands,
France, Germany, Switzerland, Austria, Italy, Spain.

Example: Feb 2-5 trip to Brussels (by rail), Feb 18 now
correctly shows "Bristol" instead of "Brussels".

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2025-07-16 04:28:15 +02:00
parent 6533165bef
commit 80e12b77ce
2 changed files with 68 additions and 16 deletions

View file

@ -13,9 +13,16 @@ def test_get_location_for_date() -> None:
trips = [
t
for t in agenda.trip.build_trip_list()
if t.start in [date(2023, 9, 8), date(2023, 11, 14), date(2025, 2, 9)]
if t.start
in [
date(2023, 2, 2),
date(2023, 9, 8),
date(2023, 11, 14),
date(2025, 2, 9),
date(2025, 7, 4),
]
]
assert len(trips) == 3
assert len(trips) == 5
data_dir = app.config["PERSONAL_DATA"]
@ -43,3 +50,13 @@ def test_get_location_for_date() -> None:
date(2023, 10, 7), trips, bookings, accommodations, airports
)
assert l2[0] == "Bristol"
l2 = agenda.busy.get_location_for_date(
date(2023, 2, 18), trips, bookings, accommodations, airports
)
assert l2[0] == "Bristol"
l2 = agenda.busy.get_location_for_date(
date(2025, 8, 2), trips, bookings, accommodations, airports
)
assert l2[0] == "Bristol"