-
Notifications
You must be signed in to change notification settings - Fork 113
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
WIP: LG-14503 Update USPS Proofing Job To Not Override Deactivation Codes on Profile #11261
base: main
Are you sure you want to change the base?
Conversation
…03-update-usps-proofing-job
…03-update-usps-proofing-job
app/models/profile.rb
Outdated
update!(active: false, in_person_verification_pending_at: nil) | ||
update!(deactivation_reason: :verification_cancelled) if !deactivation_reason.present? |
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.
Is there a way to combine this into one UPDATE to avoid the extra database call?
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.
maybe like this?
update!(active: false, in_person_verification_pending_at: nil) | |
update!(deactivation_reason: :verification_cancelled) if !deactivation_reason.present? | |
to_update = { | |
active: false, | |
in_person_verification_pending_at: nil | |
}.tap do |attrs| | |
attrs[:deactivation_reason] = :verification_cancelled if deactivation_reason.blank? | |
end | |
update!(to_update) |
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.
or maybe something like this:
update!(active: false, in_person_verification_pending_at: nil) | |
update!(deactivation_reason: :verification_cancelled) if !deactivation_reason.present? | |
update!( | |
active: false, | |
in_person_verification_pending_at: nil, | |
deactivation_reason: deactivation_reason.presence || :verification_cancelled, | |
) |
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 had never seen tap before- helpful method. Ultimately, I went went suggestion 2. Resolved with commit d0b5cb4
…s Job exclude overwriting profile deactivation reason
🎫 Ticket
LG-14503 Update USPS Proofing Results Job exclude overwriting profile deactivation reason
🛠 Summary of changes
📜 Testing Plan
get_usps_proofing_results_job_cron: '0/59 * * * *'
or some version to config/application.yml to delay the job from running so you have time to test. (The job will run on the 59 min of the hour.)Check that there is not a regression. (A profile that has an enrollment that either expired, was cancelled, or failed gets verification_cancelled assigned as the deactivation reason.)
Check new functionality
Step 11 Verify the data. (1. Enrollment status is cancelled 2. Profile is not active 3. Profile deactivation reason is encryption_error).
Step 12