Split return date nav into separate outbound/return rows; show earlier tube option on inbound

For return journeys, replace the single combined date navigation row with two
separate rows so outbound and return dates can be adjusted independently.

For inbound underground options, show one service before the earliest catchable
(as an "aim for this" option) rather than the next service after it, which
often arrived too late to connect with the GWR train.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-05-21 14:09:36 +01:00
parent 1407cb8246
commit a859b96a23
6 changed files with 82 additions and 22 deletions

View file

@ -599,7 +599,7 @@ def test_results_return_renders_outbound_and_inbound_tables(monkeypatch):
monkeypatch.setattr(
trip_planner_module.circle_line,
'upcoming_services',
lambda earliest_board, count=2, direction='pad_to_kx': (
lambda earliest_board, count=2, direction='pad_to_kx', preceding=0: (
[
(datetime(2026, 4, 10, 9, 10), datetime(2026, 4, 10, 9, 25)),
(datetime(2026, 4, 10, 9, 15), datetime(2026, 4, 10, 9, 30)),
@ -619,16 +619,19 @@ def test_results_return_renders_outbound_and_inbound_tables(monkeypatch):
assert resp.status_code == 200
assert 'Outbound: Bristol Temple Meads &rarr; Paris Gare du Nord' in html
assert 'Return: Paris Gare du Nord &rarr; Bristol Temple Meads' in html
assert 'Friday 10 April 2026 to Friday 17 April 2026' in html
assert '/results/BRI/paris/2026-04-09/return/2026-04-16' in html
assert '/results/BRI/paris/2026-04-11/return/2026-04-18' in html
assert 'Friday 10 April 2026' in html
assert 'Friday 17 April 2026' in html
assert '/results/BRI/paris/2026-04-09/return/2026-04-17' in html
assert '/results/BRI/paris/2026-04-11/return/2026-04-17' in html
assert '/results/BRI/paris/2026-04-10/return/2026-04-16' in html
assert '/results/BRI/paris/2026-04-10/return/2026-04-18' in html
assert "/results/BRI/paris/2026-04-10/return/2026-04-17" in html
assert 'journey_type=return' not in html
assert 'return_date=2026-04-17' not in html
assert 'Circle 09:10 &rarr; KX 09:25' in html
assert 'next 09:15 &rarr; KX 09:30' in html
assert 'Circle 16:40 &rarr; PAD 16:55' in html
assert 'next 16:45 &rarr; PAD 17:00' in html
assert 'earlier 16:40 &rarr; PAD 16:55' in html
assert 'Circle 16:45 &rarr; PAD 17:00' in html
assert 'title="Tight connection">⚠️</span>' in html
assert 'ES 9014' in html
assert 'ES 9035' in html