Readjust walking route departure and arrival time due to bus buffer time #274
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.
Overview
Right now, there are two cases in which we display a walking route (note that we always show a walking route), and here are screenshots of this tragic issue we've been having with walking times:
1. A walking route we get solely from Graphhopper walking (when there are no other bus routes)
Here you can notice that the start time should actually be 11:56!
2. A walking route that we get from Graphhopper bus, which involves stuffing in a bus buffer time (a trick that we've been using so that we get more routes around the time that the client sends)
Once again, the start time should actually be 11:56!
Changes Made
There are a lot of entry points that I found that I could modify the bus routes. The way that I found that was most intuitive was in
ParseRouteUtils
. InRouteUtils
, we first fetch routes withGraphhopperUtils
, and then we parse them withparseRoute
inparseRouteUtils
. I thought that I should leave fetching toGraphhopperUtils
and modifying the routes inparseRouteUtils
since we have similar logic in there. What I did was check if theroute.transfers
attribute was equal to-1
(which means it is a walking route), and just overwrite its departure and arrival times in both the walking route and the walking route'sdirection
's array (direction's start and end times) -- since we really don't know which bus buffer time (could be 20 min or 40 min difference) that was used to fetch the routes, as there's some complex logic used to merge bus routes afterwards.I also refactored
parseWalkingRoute
to match my changes above so that other people know that these are exactly the same things getting modified -- it should betime
and notdate
in the names we're using because the client is getting these with the keys named asarrivalTime
anddepartureTime
, notarrivalDate
anddepartureDate
!Now that everything's fixed, here's how it looks on the dev server:
1. A lone walking route
2. A walking route with other bus routes
3. A walking route with arriveBy as true
Test Coverage
Pushed onto the dev server as of 11/2 noon, and everything looks fine just by going through the beta app. Will have it sit for a while and see if integration picks up anything funky -- but integration isn't testing this to begin with so I'm doubtful that this is necessary.
Next Steps
Going to talk to integration about testing departure and arrival times on walking routes.
Related PRs or Issues
Resolves Issue #261