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

cleanup(ex/db/detour): remove state_value #2965

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

firestack
Copy link
Member

@firestack firestack commented Feb 18, 2025

PR for :state_value removal thread #2961 (comment)

@firestack firestack requested a review from bfauble February 18, 2025 17:17
@firestack firestack marked this pull request as ready for review February 18, 2025 17:17
@firestack firestack requested a review from a team as a code owner February 18, 2025 17:17
Base automatically changed from bf-query-with-status-field to main February 18, 2025 18:55
Copy link
Contributor

@bfauble bfauble left a comment

Choose a reason for hiding this comment

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

if possible can we try to remove any calls to categorize_detour that aren't happening before an update/create in the DB?

https://github.com/mbta/skate/blob/main/lib/skate/detours/detours.ex#L242
https://github.com/mbta/skate/blob/main/lib/skate/detours/detours.ex#L362

These should be able to just reference the status field instead of needing to calculate from the state.

Then I think we can move the logic of this function to the add_status function used within the Detour.changeset here: https://github.com/mbta/skate/blob/main/lib/skate/detours/db/detour.ex#L65 since any status updates I believe should be persisted and subsequently updated in the status field and available for use wherever needed either in a return response or side effect branching and would limit the surface area for state/prop consistency issue that could arise

@bfauble bfauble self-assigned this Feb 21, 2025
@firestack
Copy link
Member Author

if possible can we try to remove any calls to categorize_detour that aren't happening before an update/create in the DB?

Sure yeah! I'd prefer to have that in it's own PR, as this should only be concerned with the :state_value IMO.

See #2967

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