Commit graph

608 commits

Author SHA1 Message Date
Edward Betts 6286699b52 Fix location tracking for all remaining weekend test failures
Expand return-home heuristic to cover more countries and reorganize logic
to prioritize trip-based location detection over individual travel data.

Key changes:
1. Add Balkan countries (GR, AL, XK, HR, etc.) to European heuristic
2. Add major international countries (US, CA, IN, JP, etc.) to heuristic
3. Change condition from >1 day to >=1 day for faster return detection
4. Move trip heuristic check before individual flight/accommodation lookup

This fixes cases where stopovers or connections (like Kosovo→Albania on
July 1) were overriding the trip-based "return home" logic. Now correctly
detects return home from all types of trips including Balkan and
international destinations.

All weekend location tests now pass - ensures locations show "Bristol"
when free (no events) or show trip locations when traveling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 06:44:08 +02:00
Edward Betts ea4980a5d7 Fix European trip return heuristic for weekend location tracking
Adjust European short trip heuristic from >3 days to >1 day to correctly
detect when user has returned home from European trips. This fixes the
April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg"
instead of "Bristol" when the user was free (no events scheduled) after
the foss-north trip ended on April 27.

The previous logic required more than 3 days to pass before assuming
return home from European countries, but for short European trips by
rail/ferry, users typically return within 1-2 days.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 06:38:37 +02:00
Edward Betts 663dc479c2 Weekends: Don't both showing 'home' when home. 2025-07-16 04:30:13 +02:00
Edward Betts 80e12b77ce 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>
2025-07-16 04:28:58 +02:00
Edward Betts 6533165bef 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>
2025-07-16 04:18:56 +02:00
Edward Betts a92debea5b Fix same-day flight location tracking
When multiple flights arrived on the same date, location tracking
only compared dates and missed later flights. Now compares both
date and time to handle same-day connecting flights correctly.

Example: Nov 21, 2023
- 06:15: Arrive Madrid (MVD → MAD)
- 09:15: Arrive London (MAD → LHR) ← Now properly detected as most recent

This ensures users show as "home" when they've returned to UK on
the same day as an international connection.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 04:10:25 +02:00
Edward Betts af492750cb Add location tracking to weekend page
Weekend page now shows specific location (city and country) for each
Saturday and Sunday based on travel history:

- Analyzes flight arrivals and accommodation check-ins to determine exact location
- Shows "home" when at Bristol, UK
- Shows "City, 🏴 Country" format when traveling
- Handles multi-location trips by finding most recent travel within trip period
- Optimized to parse YAML files once instead of per-date lookup

Closes #191

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 03:59:35 +02:00
Edward Betts f41930f811 Use get_country for Schengen report 2025-07-15 18:12:11 +02:00
Edward Betts f499015466 Adjust weekend page high pithing
Don't highlight a week number when showing weekends for different year.

Example: https://edwardbetts.com/agenda/weekends?year=2100&week=1

Closes: #198
2025-07-15 17:48:44 +02:00
Edward Betts 7f12282c42 Add week and year parameters to weekends page.
Fixes #190
2025-07-15 17:42:47 +02:00
Edward Betts 220256dd91 Better space launch mail after space launch
Fixes #176.
2025-07-15 17:33:08 +02:00
Edward Betts 1806785700 Improve space launch change email format for better readability
Replace technical YAML diff output with human-readable bullet points that clearly explain what changed. Added structured email format with mission details, rocket emoji, and formatted dates.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 17:06:12 +02:00
Edward Betts a68df381fe Add CO2 breakdown by transport type to trip list and detail pages
Implements bug #194 by adding CO2 emission display by transport type:
- Add co2_by_transport_type() method to Trip class
- Display CO2 breakdown on trip list page and individual trip items
- Display CO2 breakdown on individual trip detail pages
- Show both total CO2 and breakdown by transport type (flight/train/ferry)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 16:57:19 +02:00
Edward Betts af49dac232 Add new country count display to trip statistics
Show the number of new countries visited each year in parentheses next to the total country count.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 16:32:59 +02:00
Edward Betts d65981ef7e Reorganize navbar with Trip and Conference dropdowns
- Move trip-related pages (Future trips, Past trips, Trip statistics) to a "Trips" dropdown
- Move conference-related pages (Conferences, Past conferences) to a "Conferences" dropdown
- Position both dropdowns between Calendar and Travel in the navbar
- Maintain active state highlighting for dropdown items and parent dropdowns

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 16:18:41 +02:00
Edward Betts 06a7d03404 Update trip statistics CO2 display with transport breakdown
- Change label from "Flight CO₂" to "Total CO₂" for accuracy
- Add CO₂ breakdown by transport type (flight/train/ferry)
- Show values in kg for <1000kg, tonnes for ≥1000kg
- Track CO₂ emissions by transport type in stats calculation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 16:04:07 +02:00
Edward Betts 5a15f48f50 Add CO2 emission calculations for train and ferry journeys
- Add CO2 calculation for train legs using 0.037 kg CO2e per passenger per km
- Add CO2 calculation for ferry journeys using 0.02254 kg CO2e per passenger per km
- Both calculations use standard emission factors from UK government sources (DEFRA/DECC)
- CO2 values are automatically included in trip totals via existing total_co2_kg() method

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 15:50:32 +02:00
Edward Betts 791759b322 Fix Schengen calculation bug
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 15:36:03 +02:00
Edward Betts 338d6ea067 Fix Schengen time tracking to use arrival date for long-haul flights
Use arrival date instead of departure date when entering Schengen countries
to correctly handle overnight flights that cross date boundaries.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 15:31:05 +02:00
Edward Betts 8363a581c7 Add trip linking and names to Schengen compliance report
- Add trip_date and trip_name fields to SchengenStay dataclass
- Implement extract_schengen_stays_with_trip_info() to associate stays with trips
- Update schengen_report.html to show trip names with clickable links
- Add Trip column to stays table and trip name column to compliance history
- Links navigate to individual trip pages using existing URL structure

Closes #197

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 15:06:09 +02:00
Edward Betts 1d37f92cfb Add margin to schengen report page 2025-07-15 13:54:20 +01:00
Edward Betts e95570a014 No need for title case in h1 2025-07-15 14:51:12 +02:00
Edward Betts fc31856f8c No need for title case 2025-07-15 14:48:18 +02:00
Edward Betts d2c4fa69ee Implement Schengen Area Compliance Report
How many close am I to 90 days in the last 180.

Fixes #193.
2025-07-15 14:43:37 +02:00
Edward Betts 084e5f44e3 Add conference count display to conference list sections
- Show count of conferences in each section (Current/Future/Past)
- Include proper pluralization (1 conference vs N conferences)
- Use Jinja2 template logic for count calculation and display

Fixes #195
2025-07-15 11:28:15 +02:00
Edward Betts 69f76746d5 Fix Geomob URLs with // in alert mails. 2025-06-26 09:04:44 +01:00
Edward Betts 59236d3ace TODO: debug why update gandi fails 2025-06-04 22:24:04 -05:00
Edward Betts 9bdf21ea5b No need to 'type: ignore' on deepdiff. 2025-05-26 10:08:05 -05:00
Edward Betts 63c7c54bfc Show CO₂ for flights on trip list. 2025-05-26 10:07:37 -05:00
Edward Betts a66565a785 Show CO₂ for flights on travel page. 2025-05-26 04:48:13 -05:00
Edward Betts f04aaf12a2 Bug fix 2025-05-26 09:53:43 +02:00
Edward Betts 9a5035d9fd Fix for flight number on trip page. 2025-05-12 13:45:26 +01:00
Edward Betts 503d39e6b8 Prefer ICAO flight number for some airlines 2025-04-28 12:13:23 +03:00
Edward Betts 8cd2335630 Add nowrap to conference list date fields 2025-04-18 14:48:22 +01:00
Edward Betts 9bc0f97976 Show flights without CO2 info. 2025-03-17 07:23:38 +00:00
Edward Betts ee1eaa1046 Handle FX rate timeouts. 2025-02-18 00:46:36 +00:00
Edward Betts c8eca13d68 Sweden has every Sunday as a holiday. 2025-02-12 08:52:18 -05:00
Edward Betts c9e7f4c61a Move holiday country codes to config. 2025-02-12 08:10:56 -05:00
Edward Betts 8c5b8400ca Bug fix 2025-02-11 19:21:06 +00:00
Edward Betts bc6fc33cda Code formatting 2025-02-09 14:48:01 +01:00
Edward Betts 938d8a5afe Reduce function complexity of in types.py 2025-02-09 14:47:30 +01:00
Edward Betts bab1d25dd4 Not flying to France 2025-02-09 13:46:56 +00:00
Edward Betts b2cef3933d Reduce complexity of agent.trip.get_locations(). 2025-02-09 13:33:11 +00:00
Edward Betts 6444229694 More validation 2025-01-30 13:34:57 +00:00
Edward Betts 24c3242189 Show CO₂ on stats page. 2025-01-30 13:34:36 +00:00
Edward Betts f6fba93a54 Add optional date parameter for weekend. 2025-01-27 08:38:55 +00:00
Edward Betts fd09faea38 Weekend page to conside hackathons. 2025-01-27 08:38:14 +00:00
Edward Betts 3a022e8736 country can be None in get_country 2025-01-24 20:31:20 +00:00
Edward Betts f5a8676336 Weekend page to show full year.
Highlight current week.
2025-01-24 20:49:16 +01:00
Edward Betts 2f574264e5 Show new badge next to new countries on travel stats page. 2025-01-24 20:19:25 +01:00