[GYR1-678] Clients who log in to GYR get stuck in a loop answering demographic questions #5593
+105
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to Jira issue
Is PM acceptance required?
Reminder: merge main into this branch and get green tests before merging to main
What was done?
Summary of problem to address: when a client logs back in later, they get stuck
in a loop of having to fill out the demographics questions over and over (which
are asked after the "Success!" page). They never are able to get to a screen
that lets them upload docs (the whole point of logging back in later).
Initial review of the business logic:
(e.g., SSN card). I base this on the logic in the already-existing
has_all_required_doc?
method that was inapp/controllers/documents/ssn_itins_controller.rb
(and which I refactoredinto a new lib).
intake flow), both examining code and experimenting with the app running
locally, to get a sense of intake flow behavior when the client reaches the
"Success!" page with versus without having uploaded the required docs.
always be
intake_in_progress
and there's no logic in the demographicsscreens etc to change that. Additonally, somehow flow logic will always
'bookmark' their intake as being at the start of the demographics questions,
no matter if they've already filled/skipped them or not.
Based on the above:
app/controllers/questions/successfully_submitted_controller.rb
, I addedlogic to transition the intake to a new state (either
intake_ready
orintake_needs_doc_help); this was basically the same logic inside
app/controllers/documents/ssn_itins_controller.rb
but here I put it inside abefore_action
method (whereas in the latter controller it happens inafter_update_succes
).It seemed like there is some nuance around how the transition logic works. The
changes I made here seem like just enough to solve the problem without affecting
anything else.
How to test?
Using Flow Explorer, test with uploading docs:
selfie, and seconary id, up to the "Success!" page. Then over in the Hub, the
newly created client should have a status (upper right hand corner) of Ready.
Using Flow Explorer, test by skipping the required doc uploads:
get to the "Success!" page, you can try either going on through the
demographics page, or not (either way, the next behaviors should work the
same; wouldn't hurt to try this both ways).
Important: Go to the Hub, confirm this client has a status of Needs Doc
Help.
Now, If you're running locally:
go to a terminal and run
bin/rails jobs:work
.Also, in a Rails console, you might need to do the following (you'll have
to figure out the right ID):
Then go home screen, click "Already started". Enter in the email address.
If you're using a heroku/other instance, use whatever method is in place to
check emails and grab the 6-digit code.
If you're running locally, pop back over to your jobs:work tail, and scroll
up to find that 6-digit code in the output.
After inputting the 6-digit code, you should land in the portal screen. The
button should say "Add missing documents" and when you click that, it should
take you to the "Here's a list of your documents." page.
This last bit of behavior was already in place, but it's worth testing it
again to be safe: Go through the process here of uploading the 3 requried
docs. Then in the Hub, the client should now have a status of Intake Ready.