From ce4256780434c74fe3d930308f8d1e6518e3510b Mon Sep 17 00:00:00 2001 From: Jonathan Hooper Date: Fri, 26 May 2023 10:23:17 -0400 Subject: [PATCH 1/2] LG-9959 Fix a bug in which in-person and GPO pending users do not have GPO pending status cleared We had a bug where users who are in the GPO pending state did not have that state cleared after entering a successful code and going through in-person proofing. This resulted in an error attempting to activate these users profiles when the enrollments background job runs. changelog: Improvements, In-person proofing, A bug in which users who were letter and in-person pending did not have their letter pending status cleared after entering a letter code resulting in the user not being proofed after visiting the post office was fixed. --- app/forms/gpo_verify_form.rb | 2 +- spec/forms/gpo_verify_form_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/forms/gpo_verify_form.rb b/app/forms/gpo_verify_form.rb index dc9be77effd..707a609d651 100644 --- a/app/forms/gpo_verify_form.rb +++ b/app/forms/gpo_verify_form.rb @@ -19,11 +19,11 @@ def submit result = valid? threatmetrix_check_failed = fraud_review_checker.fraud_check_failed? if result + pending_profile&.remove_gpo_deactivation_reason if pending_in_person_enrollment? UspsInPersonProofing::EnrollmentHelper.schedule_in_person_enrollment(user, pii) pending_profile&.deactivate(:in_person_verification_pending) elsif fraud_review_checker.fraud_check_failed? && threatmetrix_enabled? - pending_profile&.remove_gpo_deactivation_reason deactivate_for_fraud_review else pending_profile&.update!( diff --git a/spec/forms/gpo_verify_form_spec.rb b/spec/forms/gpo_verify_form_spec.rb index f04e5f49cd2..b49d9c2e93a 100644 --- a/spec/forms/gpo_verify_form_spec.rb +++ b/spec/forms/gpo_verify_form_spec.rb @@ -135,6 +135,7 @@ expect(pending_profile).not_to be_active expect(pending_profile.deactivation_reason).to eq('in_person_verification_pending') + expect(pending_profile.gpo_verification_pending?).to eq(false) end it 'updates establishing in-person enrollment to pending' do From 45e1b8dca131936bd29dc9d58a0d26c3050b335e Mon Sep 17 00:00:00 2001 From: Jonathan Hooper Date: Fri, 26 May 2023 10:32:39 -0400 Subject: [PATCH 2/2] add a rake task to fix the issue --- lib/tasks/fix_in_person_pending_user.rake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/tasks/fix_in_person_pending_user.rake diff --git a/lib/tasks/fix_in_person_pending_user.rake b/lib/tasks/fix_in_person_pending_user.rake new file mode 100644 index 00000000000..31df9e7a143 --- /dev/null +++ b/lib/tasks/fix_in_person_pending_user.rake @@ -0,0 +1,11 @@ +namespace :profiles do + desc 'If a profile is pending in-person and pending GPO remove the GPO pending status' + task fix_in_person_and_gpo_pending_user: :environment do + enrollments = InPersonEnrollment.pending.joins(:profile).where( + 'profiles.gpo_verification_pending_at IS NOT NULL', + ) + enrollments.each do |enrollment| + enrollment.profile.update!(gpo_verification_pending_at: nil) + end + end +end