Skip to content

Trip Planner [Fix]: Out of system transfer logic#3205

Merged
lvachon1 merged 5 commits into
mainfrom
lev/fix/otp/subway_transfers
May 29, 2026
Merged

Trip Planner [Fix]: Out of system transfer logic#3205
lvachon1 merged 5 commits into
mainfrom
lev/fix/otp/subway_transfers

Conversation

@lvachon1
Copy link
Copy Markdown
Contributor

@lvachon1 lvachon1 commented May 22, 2026

Scope

Asana Ticket: 🐞 Trip Planner | Fix out of system transfer logic

Implementation

Removed subway -> subway transfers from the maybe_transfer?()/@single_ride_transfer logic, as this needs to know the stations involved to properly calculate transfers. Re-added the formerly unused subway_transfer?() logic that did this already.

This is to handle the cases where OTP suggests walking between stations, but the fare was incorrectly calculated as if that was an in-fare transfer.

Screenshots

Branch

Screenshot 2026-05-22 at 1 20 34 PM

Dev

Screenshot 2026-05-22 at 1 20 18 PM

How to test

http://localhost:4001/trip-planner?plan=hsQVX3VudXNlZF9kYXRldGltZV90eXBlxADEEl91bnVzZWRfd2hlZWxjaGFpcsQAxAhkYXRldGltZcQgMjAyNi0wNS0yMlQxMjo1MDo0Ny4xMzQ4NTItMDQ6MDDEBGZyb22ExAhsYXRpdHVkZctARS_O2RaHK8QJbG9uZ2l0dWRly8BRx5y2hIvrxARuYW1lxDlIYXJ2YXJkIFNxdWFyZSwgQnJhdHRsZSBTdHJlZXQsIENhbWJyaWRnZSwgTUEsIDAyMTM4LCBVU0HEB3N0b3BfaWTEAMQFbW9kZXOJxANCVVPEBHRydWXEBUZFUlJZxAR0cnVlxARSQUlMxAR0cnVlxAZTVUJXQVnEBHRydWXEDl9wZXJzaXN0ZW50X2lkxAEwxAtfdW51c2VkX0JVU8QAxA1fdW51c2VkX0ZFUlJZxADEDF91bnVzZWRfUkFJTMQAxA5fdW51c2VkX1NVQldBWcQAxAJ0b4TECGxhdGl0dWRly0BFMxYJVsDXxAlsb25naXR1ZGXLwFG_nYg7o0TEBG5hbWXES1dvbmRlcmxhbmQgR3JleWhvdW5kIFBhcmssIDE5MCBSZXZlcmUgQmVhY2ggUGFya3dheSwgUmV2ZXJlLCBNQSwgMDIxNTEsIFVTQcQHc3RvcF9pZMQA

Any other route that involves a red to blue transfer should work.
Confirm that leaving one station and entering another on foot is included in the fare calculation.
Confirm that transfers within the fare gates are still free.

…ansfers to ensure those transfers happen in the same (or connected) stations. This is to handle the cases where OTP suggests walking between stations, but incorrectly counted that as a valid transfer.
@lvachon1 lvachon1 requested a review from a team as a code owner May 22, 2026 17:23
@lvachon1 lvachon1 requested a review from joshlarson May 22, 2026 17:23
lvachon1 added 4 commits May 22, 2026 17:36
…ic from the single_ride_trip transfer function and to allow the (formerly unused) subway_transfer?() code to handle it.
…eg handler for subway transfers. Removed redundant lower level tests.
Copy link
Copy Markdown
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because this does fix a class of bugs, but this still leaves out-standing the issue below:

Image

The fare for this should be $4.80, not $3.10.

If you want to merge as-is, I can create a follow-up ticket for this case :)

@lvachon1 lvachon1 merged commit 8b89280 into main May 29, 2026
17 checks passed
@lvachon1 lvachon1 deleted the lev/fix/otp/subway_transfers branch May 29, 2026 17:45
@lvachon1
Copy link
Copy Markdown
Contributor Author

Yeah, I feel tacking the fare bugs in small pieces is probably the best way forward. There's a lot of logic in there, and a lot of exceptions and edge cases. I'm wary of making more than one change at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants