Skip to content

Add mail_status enum to constrain possible values #1294

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 2 commits into from
Apr 8, 2025

Conversation

jamie-o-wilkinson
Copy link
Contributor

What problem does this pull request solve?

We want to prevent mail_status from being set to any string, and to document in code the possible values of mail_status. This is done using an enum in the Submission model.

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Has all relevant documentation been updated?

@jamie-o-wilkinson jamie-o-wilkinson self-assigned this Mar 26, 2025
@jamie-o-wilkinson jamie-o-wilkinson marked this pull request as ready for review March 26, 2025 15:57
stephencdaly
stephencdaly previously approved these changes Apr 7, 2025
Copy link
Contributor

@stephencdaly stephencdaly left a comment

Choose a reason for hiding this comment

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

Nice refactor. Left a suggestion that we can use the scopes that ActiveRecord provides for the enum, but not strictly necessary

lfdebrux
lfdebrux previously approved these changes Apr 7, 2025
Copy link
Member

@lfdebrux lfdebrux left a comment

Choose a reason for hiding this comment

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

Nice! 🙌

@jamie-o-wilkinson
Copy link
Contributor Author

Good spots @stephencdaly, not sure why I didn't do that in the first place 🤔 Have pushed those suggestions up now.

We want to prevent mail_status from being set to any string, and to
document in code the possible values of mail_status. This is done using
an enum in the Submission model.
Copy link

sonarqubecloud bot commented Apr 8, 2025

@jamie-o-wilkinson jamie-o-wilkinson merged commit b9203f8 into main Apr 8, 2025
4 checks passed
@jamie-o-wilkinson jamie-o-wilkinson deleted the add-mail-status-enum branch April 8, 2025 13:29
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.

3 participants