Fix location tracking for trips ending in UK
When a trip ended in the UK but had foreign accommodations during the trip, location tracking would incorrectly show the foreign location even after returning home. Added logic to detect when the most recent travel occurred within a completed trip that ended in the UK, and override foreign accommodations to show "Bristol" (home) for dates after the trip. Example: Trip Sep 8-17 with accommodation in Kochi, India on Sep 10, but trip ended at Gatwick Airport, UK. Oct 7 now correctly shows "Bristol" instead of "Kochi". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a92debea5b
commit
6533165bef
2 changed files with 21 additions and 2 deletions
|
|
@ -13,9 +13,9 @@ def test_get_location_for_date() -> None:
|
|||
trips = [
|
||||
t
|
||||
for t in agenda.trip.build_trip_list()
|
||||
if t.start in [date(2023, 11, 14), date(2025, 2, 9)]
|
||||
if t.start in [date(2023, 9, 8), date(2023, 11, 14), date(2025, 2, 9)]
|
||||
]
|
||||
assert len(trips) == 2
|
||||
assert len(trips) == 3
|
||||
|
||||
data_dir = app.config["PERSONAL_DATA"]
|
||||
|
||||
|
|
@ -38,3 +38,8 @@ def test_get_location_for_date() -> None:
|
|||
date(2023, 12, 2), trips, bookings, accommodations, airports
|
||||
)
|
||||
assert l2[0] == "Bristol"
|
||||
|
||||
l2 = agenda.busy.get_location_for_date(
|
||||
date(2023, 10, 7), trips, bookings, accommodations, airports
|
||||
)
|
||||
assert l2[0] == "Bristol"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue