feat(TripPlanner): render Massport and Logan Exp. icons and more #2123
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.
Warning
Because of the high number of files, I recommended reviewing this one commit at a time. Many of the commit messages include a more detailed description of what's going on in each.
Previewing changes in the trip planner
Summary of changes
Asana Ticket: Trip Planner display of itineraries using Logan Express & Massport Shuttle uses incorrect stop names
Important
We import the Massport GTFS into our OTP build, so that it can give us results which use Massport and Logan Express routes. My primary goal was to handle ingesting itineraries using those routes and stops in a more elegant way than we do now.
So I ended up majorly refactoring how Dotcom was parsing responses from OpenTripPlanner. Honestly I don't think it's perfect yet, but I ended up making all these other PRs to get me here... 😆
Anyway. Our prior logic responded to those Massport routes by putting together a
%Routes.Route{}
struct withcustom_route?: true
. This PR makes that ever so slightly more useful by populating our newexternal_agency_field
with the relevant agency name ("Massport" or "Logan Express" in this case). Now downstream logic can use that field's value to render specific icons, colors, fare information, and so on!Note
This leverages an open_trip_planner_client change I made, which returns itineraries as typed structs rather than plain Elixir maps. Sadly I wasn't able to leverage OTP's own GraphQL schema definition (Absinthe bug report), and I ended up creating my own model of the itinerary data. Might it become obsolete one day!
This made the result more straightforward to parse, and more fun to create an OTP-specific test factory, which was also released as part of those changes.
Many trip planner and trip planner-adjacent unit tests are refactored to use the rewritten test factory for generating trip plan itineraries, legs, and so on. Some of the updated tests could likely be cleaned up further. But I was mostly focused on "re-enable the test (if skipped) / un-break the test (if broken) and get it working".
Important
My secondary goal was to reduce the amount of supplemental data needed to render itineraries.
I wanted to see if I could piece together everything needed for the trip planner's view without invoking extra
Stops.Repo.get/1
orRoutes.Repo.get/1
calls. Theopen_trip_planner_client
update also adds thename
field to place stops and leg intermediate stops, and thetype
,color
,textColor
,desc
fields to leg routes. It mostly worked! This also made it much easier to rewrite/revise the tests.General checks