Add Circle line fare to Transfer column and Total

Add tfl_fare.py with circle_line_fare() which returns £3.10 (peak) or
£3.00 (off-peak) based on TfL Zone 1 pricing. Peak applies Monday–Friday
(excluding England public holidays) 06:30–09:30 and 16:00–19:00.

Annotate each circle service with its fare in trip_planner.py, display
it alongside the Circle line times in the Transfer column, and include
it in the journey Total.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-04-10 21:24:09 +01:00
parent 89a536dfd3
commit 35097fda4f
4 changed files with 43 additions and 4 deletions

6
app.py
View file

@ -226,8 +226,12 @@ def results(station_crs, slug, travel_date):
trip["eurostar_plus_price"] = es.get("plus_price")
trip["eurostar_plus_seats"] = es.get("plus_seats")
gwr_p = trip.get("ticket_price")
circle_svcs = trip.get("circle_services")
circle_fare = circle_svcs[0]["fare"] if circle_svcs else 0
trip["total_price"] = (
gwr_p + es_price if (gwr_p is not None and es_price is not None) else None
gwr_p + es_price + circle_fare
if (gwr_p is not None and es_price is not None)
else None
)
# If the API returned journeys but every price is None, tickets aren't on sale yet