-
Notifications
You must be signed in to change notification settings - Fork 19
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
Allow SCM Team members to perform actions on tasks for judges #13726
Conversation
Code Climate has analyzed commit 01fb1f6 and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
def additional_available_actions(_user) | ||
def additional_available_actions(user) | ||
return [] unless assigned_to == user | ||
|
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.
Ensures we're only returning judge review actions to the assignee
[ | ||
Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h, | ||
additional_available_actions(user) | ||
].flatten |
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.
- Reassign ama case at judge review to another judge by acting on a JudgeDecisionReviewTask assigned to a judge
- Reassign ama case at judge assign to another judge by acting on a JudgeAssignTask assigned to a judge
- Assign ama tasks to an attorney by acting on a JudgeAssignTask assigned to a judge via
additional_available_actions
@@ -8,7 +8,7 @@ def available_actions(user, role) | |||
Constants.TASK_ACTIONS.ASSIGN_TO_ATTORNEY.to_h, | |||
Constants.TASK_ACTIONS.REASSIGN_TO_JUDGE.to_h | |||
] | |||
elsif member_of_scm?(user) | |||
elsif user.can_act_on_behalf_of_judges? |
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.
🔥
end | ||
|
||
def legacy_appeal_tasks | ||
return [] unless user_is_judge_or_attorney? || user.can_act_on_behalf_of_judges? | ||
|
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.
General refactoring along with making sure legacy tasks show up in case details for the scm user
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.
💸 refactoring, legacy_appeal_and_user_is_judge_or_attorney_or_scm?
was just SLIGHTLY verbose
expect(DatabaseRequestCounter.get_counter(:vacols)).to eq(13) | ||
end | ||
end | ||
|
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.
Pulled out of judge test to be reused for the SCM user
errors.add(:assigned_by, "has to be a judge") if assigned_by && !assigned_by.judge_in_vacols? | ||
if assigned_by && (!assigned_by.judge_in_vacols? && !assigned_by.can_act_on_behalf_of_judges?) | ||
errors.add(:assigned_by, "has to be a judge or special case movement team member") | ||
end |
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.
Allows SCM users to be the assigner on attorney tasks as well
expect(attorney_tasks.count).to eq 3 | ||
attorney_tasks.each do |attorney_task| | ||
expect(attorney_task["attributes"]["assigned_to"]["id"]).to eq attorney.id | ||
expect(attorney_task["attributes"]["assigned_by"]["pg_id"]).to eq user.id |
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.
Ensures the assigner on the attorney task is the logged in user (scm user in our case)
expect(review_tasks.count).to eq 3 | ||
review_tasks.each do |review_task| | ||
judge_review_task = JudgeDecisionReviewTask.find(review_task["id"]) | ||
expect(review_task["attributes"]["assigned_to"]["id"]).to eq judge.id |
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.
Ensures the newly created judge decision review task is still assigned to the judge, regardless of who assigned it
end | ||
end | ||
end | ||
|
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.
Removed as all attorney tasks are created through the judge assign tasks controller
{ | ||
selected: nil, | ||
options: nil, | ||
options: user.can_act_on_behalf_of_judges? ? users_to_options(Attorney.list_all) : nil, |
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.
Ensures SCM users can view attorney assignees
Closing to break out into separate PRs! |
Resolves #12424
Description
This PR addresses all of the AC from #12424 except for Request Cases on behalf of the Judge which is addressed by #13727. Allows SCM users to perform all assigning and reassigning judges can.
Acceptance Criteria
Testing Plan
AMA at judge assign
AMA at judge decision review