fix(SF2.0/UpcomingDepartures): Don't remove Boarding train until vehicle actually leaves the station#2944
Open
joshlarson wants to merge 3 commits intomainfrom
Open
Conversation
…for `Repo.all/1` and call it from `upcoming_departures/1`
…ith currently-stopped vehicles show as `:boarding`
Contributor
Author
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.
Scope
Asana Ticket: [SF/UD] 🐞 Don't remove "boarding" train until vehicle actually leaves the station
Other Asana Ticket: [SF/UD] 🐞Show "Stopped at station"
Implementation
Turns out, the bug here wasn't in
upcoming_departures/1at all! It was inPredictions.Repo, which was discarding past subway predictions!The fix is as follows:
Predictions.Repo.all/1the option to setdiscard_past_subway_predictionstofalse(defaults totrueto avoid changing anything else unintentionally).Because this PR does a decent amount of refactor-y work on the
UpcomingDeparturestests, it may be easiest to review commit-by-commit.Screenshots
Boardingprediction at HaymarketBoardingprediction at HaymarketThis screenshot shows the same as the above, except that the train is now
Stopped at stationinstead ofBoarding.How to test
This is kind of a tricky one, because it relies on a prediction for a particular route/stop/trip drifting into the past while the vehicle serving that trip is still at the station. This doesn't happen all the time, so you may have to click around. The way I tested it was to load three windows (as you can see in the screenshots above), one in prod, and one local for the same stop (e.g. Haymarket), and one in prod or local, your call, at a stop downstream (e.g. Back Bay).
You can see this feature working when the downstream page shows a train at a station, the local version of that page shows the train
Boardingat that station (orStopped at station), and the prod version of that page omits that trip. You may have to wait a bit, and/or shift around which stops you're looking at.Notes
This actually introduces a new bug, where once the train departs from the station, it shows as
Arrivinguntil the prediction is dropped from the API. I didn't want to fix that in this PR, because there's an existing PR that introduces some changes that will make that fix a lot easier (and will also conflict with a fix if I tried to introduce said fix right now).I'll file a follow-up ticket, whose link I'll include in a comment below (if I include it here, Github will think that this PR should be assigned to that ticket, which isn't the case 🙃)