-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
…s exist for a pattern.
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.
Much cleaner and great fixes! Thank you!
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.
Clean code, nice work here
): V { | ||
let entry = entries[key] | ||
if (!entry) { | ||
entries[key] = entry = newValue(key) |
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.
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 { |
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 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( |
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 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?
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 can come later
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