Skip to content
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

Closed
wants to merge 23 commits into from

Conversation

ajspotts
Copy link
Contributor

@ajspotts ajspotts commented Mar 17, 2020

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

  • 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
  • Reassign ama tasks to an attorney by acting on an AttorneyTask assigned to an attorney
  • Cancel an ama AttorneyTask to send it back to the judge
  • Reassign ama case at judge review to another judge by acting on a JudgeDecisionReviewTask assigned to a judge
  • Assign legacy tasks to an attorney by acting on a JudgeLegacyAssignTask assigned to a judge
  • Reassign legacy case at judge assign to another judge by acting on a JudgeLegacyAssignTask assigned to a judge

Testing Plan

AMA at judge assign

  1. Sign in as BVARDUNKLE and go to /queue/3/assign (BVAAAAABSHIRE's assign queue)
  2. Pick an AMA assign task and go to the case details screen
  3. Check the starting task tree
Appeal.find_by(uuid: "52eaece1-0f6a-403a-844d-8882f7adfe3b").treee
                                         ┌────────────────────────────────────────────────────────────────────┐
Appeal 338 (evidence_submission) ───────  ID    STATUS     ASGN_BY  ASGN_TO      UPDATED_AT              
└── RootTask                              1581  on_hold             Bva          2020-03-17 20:50:11 UTC 
    ├── DistributionTask                  1582  completed           Bva          2020-03-17 20:50:53 UTC 
       └── EvidenceSubmissionWindowTask  1583  assigned            MailTeam     2020-03-17 20:50:11 UTC 
    └── JudgeAssignTask                   1584  assigned            BVAAABSHIRE  2020-03-17 20:50:53 UTC 
                                         └────────────────────────────────────────────────────────────────────┘
  1. Select "Re-assign to a judge" and reassign to "JudgeHasAttorneys_Cases"
  2. Task tree shows cancelled original assign task, new task is assigned to BVARERDMAN and assigned by BVARDUNKLE
                                         ┌───────────────────────────────────────────────────────────────────────┐
Appeal 338 (evidence_submission) ───────  ID    STATUS     ASGN_BY     ASGN_TO      UPDATED_AT              
└── RootTask                              1581  on_hold                Bva          2020-03-17 20:50:11 UTC 
    ├── DistributionTask                  1582  completed              Bva          2020-03-17 20:50:53 UTC 
       └── EvidenceSubmissionWindowTask  1583  assigned               MailTeam     2020-03-17 20:50:11 UTC 
    ├── JudgeAssignTask                   1584  cancelled              BVAAABSHIRE  2020-03-23 16:03:58 UTC 
    └── JudgeAssignTask                   1604  assigned   BVARDUNKLE  BVARERDMAN   2020-03-23 16:03:58 UTC 
                                         └───────────────────────────────────────────────────────────────────────┘
  1. Go back to the case details of this case, assigned to and assigned by are updated
  2. Select "Assign to attorney" and assign to "Steve Casper"
  3. Task tree shows complete Assign task, new decision review task is assigned to BVARERDMAN, assigned by BVARDUNKLE, and a new attorney task assigned to BVASCASPER1, assigned by BVARDUNKLE
                                         ┌───────────────────────────────────────────────────────────────────────┐
Appeal 338 (evidence_submission) ───────  ID    STATUS     ASGN_BY     ASGN_TO      UPDATED_AT              
└── RootTask                              1581  on_hold                Bva          2020-03-17 20:50:11 UTC 
    ├── DistributionTask                  1582  completed              Bva          2020-03-17 20:50:53 UTC 
       └── EvidenceSubmissionWindowTask  1583  assigned               MailTeam     2020-03-17 20:50:11 UTC 
    ├── JudgeAssignTask                   1584  cancelled              BVAAABSHIRE  2020-03-23 16:03:58 UTC 
    ├── JudgeAssignTask                   1604  completed  BVARDUNKLE  BVARERDMAN   2020-03-23 16:07:14 UTC 
    └── JudgeDecisionReviewTask           1605  on_hold    BVARDUNKLE  BVARERDMAN   2020-03-23 16:07:15 UTC 
        └── AttorneyTask                  1606  assigned   BVARDUNKLE  BVASCASPER1  2020-03-23 16:07:15 UTC 
                                         └───────────────────────────────────────────────────────────────────────┘
  1. Go back to the case details of this case, assigned to and assigned by are updated
  2. Select "Assign to attorney" and assign to "Lexi Brown"
  3. Task tree shows the updated assignee of BVALBROWN
                                         ┌───────────────────────────────────────────────────────────────────────┐
Appeal 338 (evidence_submission) ───────  ID    STATUS     ASGN_BY     ASGN_TO      UPDATED_AT              
└── RootTask                              1581  on_hold                Bva          2020-03-17 20:50:11 UTC 
    ├── DistributionTask                  1582  completed              Bva          2020-03-17 20:50:53 UTC 
       └── EvidenceSubmissionWindowTask  1583  assigned               MailTeam     2020-03-17 20:50:11 UTC 
    ├── JudgeAssignTask                   1584  cancelled              BVAAABSHIRE  2020-03-23 16:03:58 UTC 
    ├── JudgeAssignTask                   1604  completed  BVARDUNKLE  BVARERDMAN   2020-03-23 16:07:14 UTC 
    └── JudgeDecisionReviewTask           1605  on_hold    BVARDUNKLE  BVARERDMAN   2020-03-23 16:07:15 UTC 
        └── AttorneyTask                  1606  assigned   BVARDUNKLE  BVALBROWN    2020-03-23 16:09:47 UTC 
                                         └───────────────────────────────────────────────────────────────────────┘
  1. Go back to the case details of this case, assigned to is updated
  2. Select "Cancel task"
  3. Task tree shows cancelled attorney and judge decision review task, new. judge assign task assigned to BVAAABSHIRE
                                         ┌───────────────────────────────────────────────────────────────────────┐
Appeal 338 (evidence_submission) ───────  ID    STATUS     ASGN_BY     ASGN_TO      UPDATED_AT              
└── RootTask                              1581  on_hold                Bva          2020-03-17 20:50:11 UTC 
    ├── DistributionTask                  1582  completed              Bva          2020-03-17 20:50:53 UTC 
       └── EvidenceSubmissionWindowTask  1583  assigned               MailTeam     2020-03-17 20:50:11 UTC 
    ├── JudgeAssignTask                   1584  cancelled              BVAAABSHIRE  2020-03-23 16:03:58 UTC 
    ├── JudgeAssignTask                   1604  completed  BVARDUNKLE  BVARERDMAN   2020-03-23 16:07:14 UTC 
    ├── JudgeDecisionReviewTask           1605  cancelled  BVARDUNKLE  BVARERDMAN   2020-03-23 16:12:20 UTC 
       └── AttorneyTask                  1606  cancelled  BVARDUNKLE  BVALBROWN    2020-03-23 16:12:20 UTC 
    └── JudgeAssignTask                   1614  assigned               BVAAABSHIRE  2020-03-23 16:15:38 UTC 
                                         └───────────────────────────────────────────────────────────────────────┘
  • 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
  • Reassign ama tasks to an attorney by acting on an AttorneyTask assigned to an attorney
  • Cancel an ama AttorneyTask to send it back to the judge

AMA at judge decision review

  1. Pick a judge decision review task assigned to BVAAABSHIRE
uuid = JudgeDecisionReviewTask.open.where(assigned_to: User.find(3)).appeal.uuid
=> "92d5c3a6-32b4-4e9e-8a74-e1bfab94f17a"
Appeal.find_by(uuid: uuid).treee
                                ┌───────────────────────────────────────────────────────────────────────┐
Appeal 52 (direct_review) ─────  ID   STATUS     ASGN_BY      ASGN_TO      UPDATED_AT              
└── RootTask                     585  on_hold                 Bva          2020-03-05 17:16:52 UTC 
    └── JudgeDecisionReviewTask  586  assigned   CSS_ID103    BVAAABSHIRE  2020-03-05 17:16:52 UTC 
        └── AttorneyTask         587  completed  BVAAABSHIRE  BVASCASPER1  2020-03-05 17:16:52 UTC 
                                └───────────────────────────────────────────────────────────────────────┘
  1. Go to the case details page for this case (/queue/appeals/92d5c3a6-32b4-4e9e-8a74-e1bfab94f17a)
  2. Select "Re-assign to a judge" and reassign to "JudgeHasAttorneys_Cases"
  3. Task tree shows cancelled original assigne task, new task is assigned to BVARERDMAN and assigned by BVARDUNKLE, keeps the completed attorney child task
                                ┌────────────────────────────────────────────────────────────────────────┐
Appeal 52 (direct_review) ─────  ID    STATUS     ASGN_BY      ASGN_TO      UPDATED_AT              
└── RootTask                     585   on_hold                 Bva          2020-03-05 17:16:52 UTC 
    ├── JudgeDecisionReviewTask  586   cancelled  CSS_ID103    BVAAABSHIRE  2020-03-23 16:22:57 UTC 
    └── JudgeDecisionReviewTask  1615  assigned   BVARDUNKLE   BVARERDMAN   2020-03-23 16:22:57 UTC 
        └── AttorneyTask         587   completed  BVAAABSHIRE  BVASCASPER1  2020-03-23 16:22:57 UTC 
                                └────────────────────────────────────────────────────────────────────────┘
  1. Go back to the case details of this case, assigned to and assigned by are updated
  • Reassign ama case at judge review to another judge by acting on a JudgeDecisionReviewTask assigned to a judge

@codeclimate
Copy link

codeclimate bot commented Mar 17, 2020

Code Climate has analyzed commit 01fb1f6 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@hschallhorn hschallhorn self-assigned this Mar 19, 2020
@hschallhorn hschallhorn changed the title Alec/12424 scm perform judge actions Allow SCM Team members to perform actions on tasks for judges Mar 19, 2020
def additional_available_actions(_user)
def additional_available_actions(user)
return [] unless assigned_to == user

Copy link
Contributor

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
Copy link
Contributor

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?
Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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
Copy link
Contributor

@hschallhorn hschallhorn Mar 19, 2020

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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

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,
Copy link
Contributor

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

@hschallhorn
Copy link
Contributor

Closing to break out into separate PRs!

@hschallhorn hschallhorn deleted the alec/12424-scm-perform-judge-actions branch April 22, 2020 02:21
@hschallhorn hschallhorn restored the alec/12424-scm-perform-judge-actions branch April 22, 2020 02:21
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.

CM: Allow SCM Team members to perform actions for judges
3 participants