Skip to content

DT-6929 Configurable replacement busses #5417

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 4 commits into from
Jun 11, 2025
Merged

DT-6929 Configurable replacement busses #5417

merged 4 commits into from
Jun 11, 2025

Conversation

sharhio
Copy link
Contributor

@sharhio sharhio commented Jun 10, 2025

Proposed Changes

  • Bugfix: the same notification is shown multiple times (show only once if content is the same)
  • Use replacement-bus mode for configured routes

Pull Request Check List

  • A reasonable set of unit tests is included
  • Console does not show new warnings/errors
  • Changes are documented or they are self explanatory
  • This pull request does not have any merge conflicts
  • All existing tests pass in CI build

Review

  • Read and verify the code changes
  • Test the functionality by running the UI locally with all popular browsers available in your platform
  • Check that the implementation matches the design, when such one is defined in a Jira issue
  • Merge the pull request

Comment on lines 225 to 227
(route && getRouteMode(route, config)?.includes('replacement')) ||
config.replacementBusRoutes?.includes(route?.gtfsId);
const isReplacementTrip =
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this logic is clearer:

(route && 
      (
        getRouteMode(route, config).includes('replacement') ||
        config.replacementBusRoutes?.includes(route.gtfsId)
       )
);
  • tests route existence only once
  • getRouteMode always returns a value, no need for ?

@@ -115,6 +115,9 @@ export function getTransportModes(config) {
}

export function getRouteMode(route, config) {
if (config?.replacementBusRoutes?.includes(route?.gtfsId)) {
Copy link
Member

Choose a reason for hiding this comment

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

This code assumes route is defined. no need for ?

@@ -233,16 +234,22 @@ function ItineraryDetails(
route?.desc?.length
Copy link
Member

Choose a reason for hiding this comment

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

no need for ? after route

const key = `replacementBusNotification-${
route?.gtfsId || trip?.gtfsId
}`;
if (!disclaimers.some(d => d?.props?.text === notificationText)) {
Copy link
Member

Choose a reason for hiding this comment

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

no ned for ? after d.

@vesameskanen vesameskanen merged commit 84b9b8c into next Jun 11, 2025
1 check passed
@vesameskanen vesameskanen deleted the DT-6922 branch June 11, 2025 10:14
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