-
Notifications
You must be signed in to change notification settings - Fork 34
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
Core add leg route names #634
Core add leg route names #634
Conversation
40ff7ca
to
97f7254
Compare
97f7254
to
6c3bc38
Compare
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.
LGTM. What do you think about adding a function that gets a route label? I think we might already have on in OTP-RR, but might be good to have here instead.
There was a recent PR where I contributed a fix where a function like this would have been useful:
opentripplanner/otp-react-redux@a05c6bd
packages/core-utils/src/itinerary.ts
Outdated
leg: Pick<Leg, "route" | "routeShortName"> | ||
): string => { | ||
const { route, routeShortName } = leg; | ||
if (typeof route === "string") { |
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.
Let's add a comment to this that explains this block only applies for OTP1.
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.
Added in 1b3839f.
packages/core-utils/src/itinerary.ts
Outdated
return route?.shortName; | ||
}; | ||
|
||
/** Extract the route ling name for a leg returned from OTP1 or OTP2. */ |
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.
Typo: ling name
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.
Thanks, fixed in 1b3839f.
I found a use of that logic in the fare table, so I will add it. How should that be named? |
…o not rely on typeof route ===
@daniel-heppner-ibigroup Let me know what you think of 41e4aab with the new function (and revised logic). |
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.
Perfect use of that logic. Thank you for the addition, this will be useful in OTP-RR and OTP-UI.
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.
This is a great addition thanks so much
Requires #632.
This PR centralizes logic to extract a route short/long name from a Leg object.