Skip to content

feat(Departures): show in-seat transfers - #3462

Open
thecristen wants to merge 8 commits into
mainfrom
cbj/departures-continues-as
Open

feat(Departures): show in-seat transfers#3462
thecristen wants to merge 8 commits into
mainfrom
cbj/departures-continues-as

Conversation

@thecristen

Copy link
Copy Markdown
Collaborator

Scope

Asana Ticket: Follow up on "🛜 🐞 Daily Schedules sometimes doesn't show school trips "

I might.. probably will split this out into a couple smaller PRs. I mostly made this branch for testing on dev-green, but I welcome initial feedback too.

This leverages the upcoming addition to transfers to the V3 API from this PR:

Implementation

  • When fetching and parsing schedules and predictions, we include the included trip's from_trip_transfers. When parsing trips, we use that included transfer to populate a new property: next_trip_id. This indicates a trip you can transfer to.

Warning

This new data entity/relationship seemed to reveal a bug in our current JSON API-parsing code. I think it's because our trips have transfers which have trips... anyway it was recursing and performing terribly. So I had to change it! I did use AI to rewrite the JsonApi module.

  • I edited Schedules.Repo.schedule_for_trip/1 and Predictions.Repo.all/1 to detect the presence of a populated next_trip_id and fetch and append even more schedules/predictions from that. Is this too magical/heavy-handed?

Note

This output results in longer lists of schedules/predictions which might now cover more than one trip. This complicates ordering/grouping on stop_sequence, because new trips will have a new sequence of stop_sequence values.

  • Finagled the code for upcoming departures and daily schedules to find where in the list of schedules/predicted schedules we transition from one trip to the next, and insert a new value: a %Dotcom.ScheduleFinder.TripHeading{} to hold the route/headsign for later rendering.

I'm not super sure what happens during an active trip, during the transfer. Curious to find out!

Screenshots

As far as the UI is concerned, it looks almost the same as this PR!

How to test

(copied from the other PR)

In transfers.txt we can see the trips which come into play, so we can look up those trips and find departures pages to test. I've been enjoying these:

http://localhost:4001/departures?route_id=57&direction_id=1&stop_id=917
http://localhost:4001/departures?route_id=741&direction_id=0&stop_id=place-crtst
http://localhost:4001/departures?route_id=Boat-F10&direction_id=0&stop_id=Boat-Aquarium
http://localhost:4001/departures?route_id=37&direction_id=1&stop_id=11839

@thecristen
thecristen requested a review from a team as a code owner September 1, 2026 12:52
@thecristen
thecristen requested a review from lvachon1 September 1, 2026 12:52
@thecristen thecristen added the dev-green Deploy to dev-green label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-green Deploy to dev-green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant