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

Only send AttorneyTasks back to judge assign #15493

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

hschallhorn
Copy link
Contributor

@hschallhorn hschallhorn commented Oct 26, 2020

Resolves #15218

Description

Cancelling ONLY AttorneyTasks will send a case back to judge assign.

Acceptance Criteria

  • When cancelling a task, AttorneyTask subtypes return control to their parent, instead of cancelling them and creating a JudgeAssignTask
  • When cancelling a task, AttorneyTasks cancel their parent JudgeDecisionReviewTask and create a JudgeAssignTask

Testing Plan

  1. Log in as a dispatch user and send a case back to a judge
  2. Log in as the judge and send the case back to an attorney
Appeal.find_by_uuid("dc932435-af1b-4f07-8d37-f0a1088597ce").treee
                                               ┌──────────────────────────────────────────────────────────────────────────────┐
Appeal 346 (hearing) ─────────────────────────  ID    STATUS       ASGN_BY        ASGN_TO        UPDATED_AT              
└── RootTask                                    972   on_hold                     Bva            2020-10-19 14:09:00 UTC 
    ├── DistributionTask                        973   on_hold                     Bva            2020-10-19 14:09:00 UTC 
       └── HearingTask                         974   on_hold                     Bva            2020-10-19 14:09:00 UTC 
           └── ScheduleHearingTask             975   assigned                    Bva            2020-10-19 14:09:00 UTC 
    ├── JudgeDecisionReviewTask                 976   completed    CSS_ID17       BVAAWAKEFIELD  2020-10-19 14:09:01 UTC 
       └── AttorneyTask                        977   completed    BVAAWAKEFIELD  BVAABELANGER   2020-10-19 14:09:00 UTC 
    └── BvaDispatchTask                         978   on_hold                     BvaDispatch    2020-10-19 14:09:01 UTC 
        └── BvaDispatchTask                     979   on_hold                     BVAGWHITE      2020-10-26 19:48:36 UTC 
            └── JudgeDispatchReturnTask         3415  on_hold      BVAGWHITE      BVAAABSHIRE    2020-10-26 20:07:39 UTC 
                └── AttorneyDispatchReturnTask  3416  in_progress  BVAAABSHIRE    BVAEERDMAN     2020-10-26 20:08:13 UTC 
                                               └──────────────────────────────────────────────────────────────────────────────┘
  1. Log in as the attorney and cancel the task.
  2. Confirm this does not send the case back to judge assign and instead makes the parent task "assigned"
Appeal.find_by_uuid("dc932435-af1b-4f07-8d37-f0a1088597ce").treee
                                               ┌────────────────────────────────────────────────────────────────────────────┐
Appeal 346 (hearing) ─────────────────────────  ID    STATUS     ASGN_BY        ASGN_TO        UPDATED_AT              
└── RootTask                                    972   on_hold                   Bva            2020-10-19 14:09:00 UTC 
    ├── DistributionTask                        973   on_hold                   Bva            2020-10-19 14:09:00 UTC 
       └── HearingTask                         974   on_hold                   Bva            2020-10-19 14:09:00 UTC 
           └── ScheduleHearingTask             975   assigned                  Bva            2020-10-19 14:09:00 UTC 
    ├── JudgeDecisionReviewTask                 976   completed  CSS_ID17       BVAAWAKEFIELD  2020-10-19 14:09:01 UTC 
       └── AttorneyTask                        977   completed  BVAAWAKEFIELD  BVAABELANGER   2020-10-19 14:09:00 UTC 
    └── BvaDispatchTask                         978   on_hold                   BvaDispatch    2020-10-19 14:09:01 UTC 
        └── BvaDispatchTask                     979   on_hold                   BVAGWHITE      2020-10-26 19:48:36 UTC 
            └── JudgeDispatchReturnTask         3415  assigned   BVAGWHITE      BVAAABSHIRE    2020-10-26 20:09:25 UTC 
                └── AttorneyDispatchReturnTask  3416  cancelled  BVAAABSHIRE    BVAEERDMAN     2020-10-26 20:09:25 UTC 
                                               └────────────────────────────────────────────────────────────────────────────┘

@hschallhorn hschallhorn self-assigned this Oct 26, 2020
def update_params_will_cancel_task?(params)
params[:status].eql?(Constants.TASK_STATUSES.cancelled)
def update_params_will_cancel_attorney_task?(params)
type == AttorneyTask.name && params[:status].eql?(Constants.TASK_STATUSES.cancelled)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change! Only AttyTasks go back to judge assign, not subclasses

@@ -416,7 +416,7 @@ def self.find_first_task_or_create(appeal, task_type)
parent { create(:ama_judge_decision_review_task, appeal: appeal) }
end

factory :ama_judge_dispatch_return_to_attorney_task, class: AttorneyDispatchReturnTask do
factory :ama_attorney_dispatch_return_task, class: AttorneyDispatchReturnTask do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sneaky rename

it "calls send_back_to_judge_assign!" do
tasks = attorney_task.update_from_params({ status: Constants.TASK_STATUSES.cancelled }, attorney)
tasks = subject
Copy link
Contributor Author

Choose a reason for hiding this comment

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

General refactoring

Copy link
Contributor

@lomky lomky left a comment

Choose a reason for hiding this comment

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

🎉 :shipit:

@hschallhorn hschallhorn added the Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master label Oct 26, 2020
@codeclimate
Copy link

codeclimate bot commented Oct 26, 2020

Code Climate has analyzed commit 59cb904 and detected 0 issues on this pull request.

View more on Code Climate.

@va-bot va-bot merged commit fa497c3 into master Oct 26, 2020
@va-bot va-bot deleted the hschallhorn/15218-cancel-attoney-task-only branch October 26, 2020 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready-to-Merge This PR is ready to be merged and will be picked up by va-bot to automatically merge to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancellation of an AttorneyRewriteTask should reactivate JudgeDecisionReviewTask, not JudgeAssignTask
3 participants