fix(SF2.0/UpcomingDepartures): Handle trips that visit stops multiple times #2909
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] All Modes: Disambiguate upcoming departures by trip ID AND stop sequence
Implementation
This does two things:
stop_sequenceto the%UpcomingDeparturestruct and uses that as well astrip_idto set the HTML element ID for the upcoming departure rows, thus removing duplicate ID's on certain pages. This fixes a bug, because LiveView gets pretty confused when there are duplicate ID's on live-updating elements (see screenshot below).stop_sequenceas well asstop_idto determine which stop to highlight in the expanded trip details.Screenshots
Duplicate ID Behavior
Better stop-pin markers
How to test
Visit a route/stop combo that's visited multiple times by the same trip (e.g. the 8 at Ruggles), and expand different departures for the same trip (for the 8 at Ruggles, you'll be able to tell because they come in pairs separated by 1-2 minutes). Rejoice that each trip details only has one stop pin, and the stop pins are different between them (for the 8 at Ruggles, the first one will have a pin at
Upper Buswayand the second will have a pin atLower Busway Lane 1).You could also check the 120 at Orient Heights - there won't be duplicate departure rows, because the second visit is the end of the trip, but you can still rejoice at the absence of a stop pin on the second Orient Heights visit in trip details.