Skip to content

Add alternate route names to itin description #1406

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

Merged
merged 7 commits into from
Jun 11, 2025

Conversation

amy-corson-ibigroup
Copy link
Contributor

@amy-corson-ibigroup amy-corson-ibigroup commented May 29, 2025

Description:
Adds the alternative route to the itinerary description in the case that itineraries are merged

PR Checklist:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?
UI AT
image image

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Should we extract the alternateRouteNames extraction code to a new method?

const alternateRouteNames =
leg.alternateRoutes &&
Object.entries(leg.alternateRoutes).map(
(route) => route[1].routeShortName
Copy link
Collaborator

Choose a reason for hiding this comment

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

Route short name is sometimes not specified! This should be an optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a filter to this list to match the one on line 74

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is good but not what I was talking about! route[1] might not contain routeShortName which is the issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, added a fallback to this line

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

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

Works, but could possibly be cleaned up a bit more

const alternateRouteNames =
leg.alternateRoutes &&
getAlternateRoutesFromLeg(leg)
.map((route) => route[1].routeShortName || undefined)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line makes me feel uncomfortable. Without optionals this feels like a disaster waiting to happen... Can we add some optionals here instead of the || undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair, I was keeping the function consistent, but I agree with you it doesn't make sense to have routes without short names not represented in the list. I added a fallback for the alternate routes but also the default route below.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great! We should maybe throw a comment in here saying that this could all be cleaned up in the future... Probably when we implement nextLegs!

Copy link
Contributor

@josh-willis-arcadis josh-willis-arcadis left a comment

Choose a reason for hiding this comment

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

LGTM

@amy-corson-ibigroup amy-corson-ibigroup merged commit 22d86de into dev Jun 11, 2025
9 checks passed
@amy-corson-ibigroup amy-corson-ibigroup deleted the alternate-route-in-desc branch June 11, 2025 16:40
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.

3 participants