diff --git a/app.py b/app.py index 2ad3fce..2d2a2e2 100644 --- a/app.py +++ b/app.py @@ -36,7 +36,13 @@ DESTINATIONS = { @app.route('/') def index(): today = date.today().isoformat() - return render_template('index.html', destinations=DESTINATIONS, today=today) + return render_template( + 'index.html', + destinations=DESTINATIONS, + today=today, + valid_min_connections=sorted(VALID_MIN_CONNECTIONS), + valid_max_connections=sorted(VALID_MAX_CONNECTIONS), + ) VALID_MIN_CONNECTIONS = {45, 50, 60, 70, 80, 90, 100, 110, 120} diff --git a/templates/index.html b/templates/index.html index c8300a4..306fb90 100644 --- a/templates/index.html +++ b/templates/index.html @@ -47,7 +47,7 @@ Minimum connection time (Paddington → St Pancras) @@ -58,7 +58,7 @@ Maximum connection time (Paddington → St Pancras) diff --git a/templates/results.html b/templates/results.html index 9e71bbb..999fe2a 100644 --- a/templates/results.html +++ b/templates/results.html @@ -144,7 +144,7 @@
{{ row.ticket_name }} - {{ row.connection_duration }} + {{ row.connection_duration }}{% if row.connection_minutes < 80 %} ⚠️{% endif %} {{ row.depart_st_pancras }} diff --git a/trip_planner.py b/trip_planner.py index 4aa2ed2..c7e3286 100644 --- a/trip_planner.py +++ b/trip_planner.py @@ -127,6 +127,7 @@ def combine_trips( 'arrive_paddington': gwr['arrive_paddington'], 'headcode': gwr.get('headcode', ''), 'gwr_duration': _fmt_duration(int((arr_pad - dep_bri).total_seconds() / 60)), + 'connection_minutes': int((dep_stp - arr_pad).total_seconds() / 60), 'connection_duration': _fmt_duration(int((dep_stp - arr_pad).total_seconds() / 60)), 'depart_st_pancras': es['depart_st_pancras'], 'arrive_destination': es['arrive_destination'],