Skip to content

Don't send GPO reminders to users with active profiles#10502

Merged
matthinz merged 1 commit intomainfrom
matthinz/13167-dont-remind-active-users
Apr 24, 2024
Merged

Don't send GPO reminders to users with active profiles#10502
matthinz merged 1 commit intomainfrom
matthinz/13167-dont-remind-active-users

Conversation

@matthinz
Copy link
Contributor

🎫 Ticket

Link to the relevant ticket:
LG-13167

🛠 Summary of changes

Fixes an issue in production where we get a NoMethodError when sending GPO reminder emails because we currently have a user with both a GPO pending profile and an active profile.

Ensure the user doesn't have an active profile before we try to send them a reminder email.

changelog: Bug Fixes, Identity verification, Don't send GPO reminder emails to users with active profiles
@matthinz matthinz requested a review from a team April 24, 2024 22:05
reminder_eligible_range =
IdentityConfig.store.usps_confirmation_max_days.days.ago..for_letters_sent_before
profiles_due_for_reminder(for_letters_sent_before).each do |profile|
next if profile.user.active_profile
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spent a few minutes trying to adjust the ActiveRecord query to just find profiles for users that don't have an active profile, but gave up and went with this. The numbers are pretty small in production, so there's not too much associated waste with doing this filtering in Ruby code rather than in SQL.

@matthinz matthinz merged commit 5600a91 into main Apr 24, 2024
@matthinz matthinz deleted the matthinz/13167-dont-remind-active-users branch April 24, 2024 23:02
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