Skip to content
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

Fix stop viewer next days departures #1005

Merged
merged 13 commits into from
Oct 3, 2023

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Sep 20, 2023

Description

This PR fixes the departure days in the Stop Viewer for trips that only have departures in the next days and not the current day. Specifically, trip departures are grouped by departure day (or service day) based on the data returned by OTP instead of an arbitrary rule.

PR Checklist

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

@binh-dam-ibigroup binh-dam-ibigroup marked this pull request as ready for review September 21, 2023 13:22
@amy-corson-ibigroup amy-corson-ibigroup self-assigned this Sep 26, 2023
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.

Much cleaner and great fixes! Thank you!

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.

Clean code, nice work here

): V {
let entry = entries[key]
if (!entry) {
entries[key] = entry = newValue(key)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't say I've seen this done before in Javascript. Had to look run an experiment to see what happens here. I wonder if it would be more clear if it were on two lines?

@@ -66,6 +65,17 @@ export interface Time {
tripId: string
}

export interface PatternStopTimes {
Copy link
Contributor

Choose a reason for hiding this comment

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

This type is different from the one returned in the GraphQL API, which is an issue for the Nearby View. Let's get this merged in and then we can figure out what to do in the Nearby View branch before merging it.

}

/** Helper to sort and group stop times by pattern by service day */
export function groupAndSortStopTimesByPatternByDay(
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is super clean, but since the shape of the graphql stoptimes response is different it might have to be adapted in the future. I wonder if we shouldn't build it for the new API and then transform the old API into the new shape for now?

Copy link
Contributor

Choose a reason for hiding this comment

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

This can come later

@binh-dam-ibigroup binh-dam-ibigroup merged commit 1420eaa into dev Oct 3, 2023
6 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the fix-stopvw-departures-nextdays branch October 3, 2023 01:39
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