-
Notifications
You must be signed in to change notification settings - Fork 17
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
Expand the only_open_task_of_type validation to AttorneyTask and JudgeDecisionReviewTask #16586
Conversation
Code Climate has analyzed commit 2a0d120 and detected 0 issues on this pull request. View more on Code Climate. |
Via slack, Yoom had encouraged me to answer the below question on my own:
My understanding is that when a judge completes a |
@yoomlam PR ready for review. TY! |
|
||
private | ||
|
||
def only_open_task_of_type |
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.
This felt odd even as I typed it, but it was necessary to maintain the docket switch flow. Maybe we should check with the board that we want to allow multiple DocketSwitchDeniedTask
and DocketSwitchGrantedTask
instances for one appeal?
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.
@eileen-nava Yes, check with Foxtrot and @araposo-tistatech first.
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.
Ann-Marie directed me to Foxtrot. Slack response from Yang:
I believe there should only ever be two open DocketSwitchAbstractAttorneyTasks on an appeal, parent assigned to COTB and child assigned to a user.
Yang also noted that @jcq created this task tree structure. I'll check with JC about this when he is back from PTO.
For now, overriding the validation seems fine.
expect(page).to have_content("Looks like this appeal already has an open JudgeDecisionReviewTask "\ | ||
"and this action cannot be completed.") |
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.
Let's change this error message to:
expect(page).to have_content("Looks like this appeal already has an open JudgeDecisionReviewTask "\ | |
"and this action cannot be completed.") | |
expect(page).to have_content("This appeal already has an open JudgeDecisionReviewTask "\ | |
"and this action cannot be completed.") |
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.
The current error message was suggested by design in a slack conversation with @mbaenatan and @rutvigupta-design. I'd appreciate their thoughts on any changes.
spec/models/appeal_spec.rb
Outdated
@@ -919,7 +935,7 @@ | |||
end | |||
|
|||
it "should know the right assigned attorney with a cancelled task" do | |||
task2.update(status: "cancelled") | |||
appeal.tasks.open.of_type("AttorneyTask").last.update!(status: Constants.TASK_STATUSES.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.
appeal.tasks.open.of_type("AttorneyTask").last.update!(status: Constants.TASK_STATUSES.cancelled) | |
task2.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.
Minor suggestions.
Very nice work! A side-effect is that now, our tests are more realistic (only 1 open task of certain type at a time).
Related feature test: PR #16582 |
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.
🥇
Resolves jira ticket Research and prevent recurrence of bug where one case has multiple JudgeAssignTasks, JudgeDecisionReviewTasks, and AttorneyTasks .
Relates to github PR Write feature test to replicate scenario with multiple Judge/Attorney tasks.
Description
A bug occurred in production where a user created multiple Judge and Attorney tasks by doing the same actions in two different tabs, as described in this comment from Yoom.
The
JudgeAssignTask
model already had a validation to ensure that an appeal cannot have more than oneJudgeAssignTask
open at the same time. I expanded this validation to theJudgeDecisionReviewTask
andAttorneyTask
models. I also refactored the validation to use instance variables instead of thread-local variables, as suggested in this StackOverflow post that Yoom linked in a previous thread.Acceptance Criteria
JudgeAssignTask
in two different windows, they will not be able to create multipleJudgeDecisionReviewTask
s andAttorneyTask
s.Testing Plan
[ ] Find an appeal with an open
JudgeAssignTask
[ ] On local caseflow, switch users to the judge who has the
JudgeAssignTask
assigned to them[ ] Navigate to the case details page for the relevant appeal. Open the same page in a second tab
/queue/appeals/${appeal.uuid}
[ ] In the first tab, reassign the
JudgeAssignTask
to another judge[ ] In the second tab, attempt to complete the
JudgeAssignTask
by assigning the case to an attorney. You should not be able to complete this action