-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update to cancelled_trip group filter #289
Conversation
Coverage of commit
|
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.
Added a small suggestion you can take or leave, but otherwise 👍 just on the code side. I think it would be good to get a ✅ from Beatrix, too, since she obviously knows this codebase much better than I do.
@@ -21,6 +21,9 @@ defmodule Concentrate.GroupFilter.CancelledTrip do | |||
is_nil(time) -> | |||
group | |||
|
|||
Enum.all?(stop_time_updates, &(StopTimeUpdate.schedule_relationship(&1) == :SKIPPED)) -> |
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.
suggestion (non-blocking): To point out an additional option, you could also make a function called skipped?
or something like that on StopTimeUpdate
that does the == :SKIPPED
check. Maybe more style preference than anything, but it would encapsulate knowledge about the schedule_relationship
property and the :SKIPPED
value.
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.
could you deploy this to one of the dev environments so we can check out how it works?
@@ -21,6 +21,9 @@ defmodule Concentrate.GroupFilter.CancelledTrip do | |||
is_nil(time) -> | |||
group | |||
|
|||
Enum.all?(stop_time_updates, &(StopTimeUpdate.schedule_relationship(&1) == :SKIPPED)) -> |
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.
suggestion: can we move this to the end? Since it needs to iterate over all the stop time updates, we might be able to avoid the work if the trip or route is already cancelled.
faac5c0
to
304d372
Compare
…tes have skipped status
304d372
to
e26d322
Compare
Coverage of commit
|
I just deployed it on |
Enum.all?(stop_time_updates, &StopTimeUpdate.skipped?(&1)) -> | ||
cancel_group(group) |
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.
question: do you know if we should also cancel the group if the STUs are all skipped but the first one's time is nil
like the case on line 21?
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'm actually not sure which rule should take precedence, and there doesn't seem to be a test around the case on line 21. I'll ask on the ticket and see if someone can clarify.
e26d322
to
e9f37c9
Compare
Coverage of commit
|
Summary of changes
Cancelled trip group filter now filters out trips where all stop updates have SKIPPED status
Asana Ticket: Add trip-level schedule_relationship for canceled bus trips
This change surfaces a trip-level schedule relationship of CANCELED for bus trips where all of the associated stop time updates have been given the SKIPPED status.