Skip to content

Conversation

@binh-dam-ibigroup
Copy link
Collaborator

Description:

This PR fixes headsigns where the route short name is prepended multiple times.

PR Checklist:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?
Before After
before screenshot after screenshot

@binh-dam-ibigroup binh-dam-ibigroup changed the title fix(util/viewer): Remove leading route short names in headsigns Remove route short names in headsigns Jan 2, 2026
Copy link
Contributor

@amy-corson-ibigroup amy-corson-ibigroup left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just a clarifying question to make sure I'm understanding correctly.

Comment on lines 103 to 104
calendarMax="2027-12-31"
calendarMin="2026-01-01"
Copy link
Contributor

Choose a reason for hiding this comment

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

happy new year :)

Comment on lines +69 to +74
while (finalHeadsign.startsWith(`${routeShortName} `)) {
finalHeadsign = finalHeadsign.substring(routeShortName.length + 1)
}
}
return finalHeadsign
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure I understand, we're not using something like replaceAll here because we wouldn't want to remove characters that aren't actually the short name, right? For example if the shortname was something like "A" we wouldn't want to accidentally take out all the "a"s

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct.

Copy link
Contributor

@daniel-heppner-ibigroup daniel-heppner-ibigroup left a comment

Choose a reason for hiding this comment

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

Code looks good, do we know why the short name was getting prepended to the pattern name multiple times? Is there some other issue we should look into that's causing that?

@binh-dam-ibigroup
Copy link
Collaborator Author

Code looks good, do we know why the short name was getting prepended to the pattern name multiple times? Is there some other issue we should look into that's causing that?

@daniel-heppner-ibigroup This is probably where it is happening: https://github.com/opentripplanner/OpenTripPlanner/blob/24ade9781126307afd08cbe7eda427935e6cfddc/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java#L124, where the StringBuilder is initialized with the route short name, and the trip headsign is appended, where the trip headsign also includes the route short name.

@binh-dam-ibigroup binh-dam-ibigroup merged commit 80e778f into dev Jan 7, 2026
9 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the fix-xpress-headsigns branch January 7, 2026 14:45
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.

4 participants