-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(StopPageRedesign): use route patterns #1759
Conversation
use the router route's `loader` function to fetch the stop's route patterns
defp route_patterns_by_route_and_headsign(stop_id) do | ||
stop_id | ||
|> RoutePatterns.Repo.by_stop_id() | ||
|> Enum.reject(&ends_at?(&1, stop_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there was a check for "is at last stop" on the JS side. Has that been removed since it's happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@i0sea Yep, it's been removed!
|> Map.put(:polylines, route_polylines(route, stop_id)) | ||
end) | ||
@spec get(Plug.Conn.t(), map) :: Plug.Conn.t() | ||
def get(conn, %{"route_ids" => route_ids} = _params) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: rename to get_by_route_ids
for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@i0sea okay, changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this was occuring before these changes but am noticing routes that never stop at a given stop being listed with a headsign -> no upcoming trips. Example the 32 never stops here but is listed anyway. The oneway headsigns do appear to be dropped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: noticing above issue on dev green as well so unrelated to these changes 🚀
@i0sea good looking out -- looks like the 32 does stop there, but under one of the uncommon route variants. Can also see a couple schedules from this route at that stop here: |
Summary of changes
Asana Ticket: Stops showing Headsign for Route Even if One Direction of Travel
Backend highlights
/api/stop/:stop_id/route-patterns
to get a JSON object of augmented route patterns grouped by headsign and route ID./routes/by-stop/:stop_id
with/routes/:route_ids
that returns a JSON response containing a simple list of routes.Frontend highlights
loader
to the React Router's configuration to fetch the route patterns, which will be available from within child components via React Router'suseLoaderData()
hook. Disables revalidation because this data is not going to change.departureInfoInRoutePatterns
, to filter the list of departures against a list of route patterns.<StopPageRedesign />
<DeparturesAndMap />
routesWithPolylines
prop<StopPageDepartures />
<DepartureCard />
routePatternsByHeadsign
prop<DepartureTimes />
per each headsignonClick
variable to pass to child<DepartureTimes />
headsign
,isCR
, andonClick
propsroute
,directionId
andstopName
props.departuresForDirection
prop to justdepartures
(they were filtered bydepartureInfoInRoutePatterns
earlier)General checks
New endpoints, or non-trivial changes to current endpoints