Skip to content

Jmax/LG-9565 fix GPO reminder query#9080

Merged
jmax-gsa merged 17 commits intomainfrom
jmax/LG-9565-gpo-reminder-fixed-query
Aug 30, 2023
Merged

Jmax/LG-9565 fix GPO reminder query#9080
jmax-gsa merged 17 commits intomainfrom
jmax/LG-9565-gpo-reminder-fixed-query

Conversation

@jmax-gsa
Copy link
Contributor

@jmax-gsa jmax-gsa commented Aug 24, 2023

🎫 Ticket

LG-9565

🛠 Summary of changes

The original query to retrieve users who need a reminder letter did not respect the 30-day cutoff (we shouldn't remind users if their request for a letter is older than 30 days).

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Log in to the app and create two users in the IdV remote GPO address confirmation flow.
  • Using the rails console, back date one user's gpo request date (in the user's pending profile) to 30 days, and the other user's to 29 days ago
  • Use the Rails console to run the gpo reminder job (GpoReminderJob.new.perform(14.days.ago))
  • Verify that the user with the 29 day old GPO code receives a reminder, and that the user with a 30 day old GPO code does not.

@jmax-gsa jmax-gsa force-pushed the jmax/LG-9565-gpo-reminder-fixed-query branch from 4918695 to f3858c0 Compare August 24, 2023 20:29
@jmax-gsa jmax-gsa marked this pull request as ready for review August 25, 2023 14:19
@jmax-gsa jmax-gsa requested review from a team and jmhooper August 25, 2023 14:19
Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

LGTM, and I'm deferring to @jmhooper to make sure we didn't miss any more edge cases.

gpo_verification_pending_at: ..for_letters_sent_before,
gpo_verification_pending_at: letter_eligible_range,
gpo_confirmation_codes: { reminder_sent_at: nil },
deactivation_reason: nil,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will skip users that are also going through in person verification. If we wait to merge until the transition to in_person_verification_pending_at is complete, this will work as intended. Otherwise we need to include deactivation_reason: in_person_verification_pending.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, otherwise we need to add some clauses here to filter on deactivation_reason being nil or deactivation_reason being the in-person pending enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a test case to catch this and code to handle it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked for a case where the deactivation reason is set to the in-person pending enum but couldn't find it. Where should I be looking for that one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, I see now. The with_pending_in_person_enrollment on the user factory creates a profile with the deactivation reason.

profiles_due_for_reminder = Profile.joins(:gpo_confirmation_codes).
where(
gpo_verification_pending_at: ..for_letters_sent_before,
gpo_verification_pending_at: letter_eligible_range,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should work. I can't figure out a way that we would send a letter to user who is not GPO eligible. If a case does exist I'm pretty confident it is a rare corner case.

A user who is in the in-person flow can also request a GPO
letter. They should get GPO reminder letters.
@jmax-gsa jmax-gsa merged commit d4ebd9b into main Aug 30, 2023
@jmax-gsa jmax-gsa deleted the jmax/LG-9565-gpo-reminder-fixed-query branch August 30, 2023 17:17
@mdiarra3 mdiarra3 mentioned this pull request Aug 31, 2023
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