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

Only send complete application reminders when email present #51726

Merged
merged 3 commits into from
May 22, 2023

Conversation

megcrenshaw
Copy link
Contributor

@megcrenshaw megcrenshaw commented May 5, 2023

When clearing the queue of unsent mailers, I found some incomplete emails that were trying to send but were unable to do so because no email was present. This PR changes the "complete application reminders" to only select incomplete apps that also have an email.

Links

Testing story

Added unit tests to reflect updates

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@megcrenshaw megcrenshaw changed the title Meg/only send mail when email present Only send complete application reminders when email present May 5, 2023
@megcrenshaw megcrenshaw force-pushed the meg/only-send-mail-when-email-present branch from 6321e5e to 5fce4f7 Compare May 5, 2023 16:48
@megcrenshaw megcrenshaw marked this pull request as ready for review May 5, 2023 16:56
@megcrenshaw megcrenshaw requested a review from a team May 5, 2023 16:56
Copy link
Contributor

@TurnerRiley TurnerRiley left a comment

Choose a reason for hiding this comment

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

One nit but overall this looks great! The tests look amazing too!

Comment on lines +47 to +50
where(application_year: Pd::Application::ActiveApplicationModels::APPLICATION_CURRENT_YEAR, status: 'incomplete').
select do |app|
app.email.present?
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious if we need the 'where' and 'select' clauses separated here when they're both being used to filter out, could these be combined? (not sure if this runs two separate pass throughs under the hood or not, but it may at least be simpler to read by having all conditions within the same clause). Maybe select do |app| and then check if it meets the 3 criteria (application year, incomplete, and email present)

Copy link
Member

Choose a reason for hiding this comment

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

Good question Turner. There is an argument to "optimize later" by doing it all with select, but in this case I agree with Meg that it seems worth the extra step to get a smaller response sent back from the database.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the question, Turner, and thanks for the explanation, Dave! I had to read more to understand this fully. I found these articles helpful FWIW:

Comment on lines +47 to +50
where(application_year: Pd::Application::ActiveApplicationModels::APPLICATION_CURRENT_YEAR, status: 'incomplete').
select do |app|
app.email.present?
end
Copy link
Member

Choose a reason for hiding this comment

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

Good question Turner. There is an argument to "optimize later" by doing it all with select, but in this case I agree with Meg that it seems worth the extra step to get a smaller response sent back from the database.

@megcrenshaw megcrenshaw merged commit fbe3646 into staging May 22, 2023
2 checks passed
@megcrenshaw megcrenshaw deleted the meg/only-send-mail-when-email-present branch May 22, 2023 18:03
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.

None yet

3 participants