Filters apply live everywhere, and every route calendar honours the trip-span cap - #65
Merged
Merged
Conversation
…rip-span cap Two gaps left over from the form-calendar fix. 1. A filter only ever repainted the form calendar. Change "Max correspondances" while results were on screen and the list — and the possible-days / return calendars inside it — kept grading the old budget until Search was pressed again. A filter is one deliberate choice, not a half-typed field, so it now applies live: applyFilterChange repaints the form calendar AND refreshes the results for that route in place (same history entry, applied value in the URL). Wired to every filter, the radius, the trip span, hidden trains and the Ideas/tour region. The staged-edit model is untouched where it earns its keep: a typed route (departure, destination, legs, cities) still waits for Search, and a filter change never smuggles one in — the refresh is skipped when the form's route or date no longer matches what is on screen. The bare landing form and the post-reload "press Search" prompt stay staged too: nothing on screen to bring up to date. 2. The Advanced "max trip span (days)" applied to the journey LISTS only, so an exact-route calendar could show a green day whose list the span cap then emptied. odJourneyOptsFor now returns the widened day pool and the accept-filter together, and the one-way calendar, the round-trip return calendar and the form calendar all grade with it — the same sweep their list runs. On the committed snapshot, Paris → Toulouse with 3 changes drops from 8 green days to 6 under a 1-day span, matching the trains actually listed. Tests: the smoke suite now covers a staged route edit vs a live filter change (and that a filter can't commit a staged route), the reload prompt still owning the first run, and the span cap in odJourneyOptsFor; a new E2E scenario covers the live filter end to end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #64, closing the two gaps that fix left open.
1. A filter now applies live — the results follow it, not just the form calendar
#64 made the form calendar repaint on a filter change, but the results — the list and the possible-days / return calendars inside it — kept grading the old budget until Search was pressed again. Changing "Max correspondances" while looking at a route left the page half-updated.
A filter is one deliberate choice, not a half-typed field, so
applyFilterChangenow repaints the form calendar and refreshes the results for that route in place: same history entry, applied value in the URL. Wired to every filter plus the radius, the trip span, hidden trains and the Ideas/tour region.The staged-edit model is untouched where it earns its keep:
2. Every exact-route calendar honours "max trip span (days)"
The Advanced span cap applied to the journey lists only, so a calendar could show a green day whose list the cap then emptied — a dead-end day.
odJourneyOptsFornow returns the widened day pool and the accept-filter together, and the one-way calendar, the round-trip return calendar and the form calendar all grade with it: the same sweep their list runs. It also collapses the three duplicatedpassesVia+withinSpanfilter pairs into oneaccept.Verification
conn=2in the URL, no new history entry); with 3 changes the results calendar drops from 8 green days to 6 under a 1-day span, matching the trains actually listed.odJourneyOptsFor's span cap + via hub — 156 unit tests, plus a new E2E scenario for the live filter (15/15).tsc --noEmit,npm test,npm run build,npm run test:e2e.docs/user-flows.mdupdated with the live-filter/staged-route contract and the span-aware calendars (and two stale builder names in the calendar table corrected).Generated by Claude Code