Skip to content

Commit

Permalink
Reassigning LegacyAppeal drafting to another attorney clears overtime…
Browse files Browse the repository at this point in the history
… status (#14690)

Resolves #14366 

### Description
Legacy Appeals assigned to an attorney for drafting marked for overtime will have that overtime status cleared if reassigned to another attorney

### Acceptance Criteria
- [ ] OT status is cleared for:
  - Legacy Appeals
    - Assigned to an attorney for drafting
    - Marked for overtime
  - that are then: Reassigned to another attorney

### Testing Plan
1. Checkout master
1. Exit all db access and run `make reset`
1. Disable DAS deprecation: `FeatureToggle.disable!(:legacy_das_deprecation)`
1. Sign in as Abshire and navigate to the [assign queue](http://localhost:3000/queue/BVAAABSHIRE/assign)
1. Mark Legacy Appeal `Evangeline R Mac Gyver` as OT, assign the case to Attorney Reanna
1. Navigate to the assign queue and click Attorney Reanna's work queue
1. Reassign the  `Evangeline R Mac Gyver` case to Lela 
   - [ ] OT status retained
1. checkout this branch! 
1. Reassign the  `Evangeline R Mac Gyver` case to Reanna
   - [ ] OT status removed
  • Loading branch information
lomky committed Jul 16, 2020
1 parent 12ac8da commit bbcc6c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/controllers/legacy_tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def update

return invalid_record_error(task) unless task.valid?

# Remove overtime status of an appeal when reassigning to another attorney
appeal.overtime = false if appeal.overtime?

render json: {
task: json_task(AttorneyLegacyTask.from_vacols(
task.last_case_assignment,
Expand Down
17 changes: 14 additions & 3 deletions spec/controllers/legacy_tasks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,13 @@
let(:role) { :attorney_role }
let(:params) do
{
"assigned_to_id": user.id
"assigned_to_id": user.id,
"appeal_id": @appeal.id
}
end
before do
@appeal = create(:legacy_appeal, vacols_case: create(:case, staff: @staff_user))
end

it "fails because the current user is not a judge" do
patch :update, params: { tasks: params, id: "3615398-2018-04-18" }
Expand All @@ -284,12 +288,16 @@
let(:role) { :judge_role }
let(:params) do
{
"assigned_to_id": attorney.id
"assigned_to_id": attorney.id,
"appeal_id": @appeal.id
}
end
before do
FeatureToggle.enable!(:overtime_revamp)
@appeal = create(:legacy_appeal, vacols_case: create(:case, staff: @staff_user))
@appeal.update!(overtime: true)
end
after { FeatureToggle.disable!(:overtime_revamp) }

it "should be successful" do
allow(QueueRepository).to receive(:reassign_case_to_attorney!).with(
Expand All @@ -299,14 +307,17 @@
created_in_vacols_date: "2018-04-18".to_date
).and_return(true)

expect(@appeal.overtime?).to be true
patch :update, params: { tasks: params, id: "#{@appeal.vacols_id}-2018-04-18" }
expect(@appeal.reload.overtime?).to be false
expect(response.status).to eq 200
end

context "when attorney is not found" do
let(:params) do
{
"assigned_to_id": 7_777_777_777
"assigned_to_id": 7_777_777_777,
"appeal_id": @appeal.id
}
end

Expand Down

0 comments on commit bbcc6c8

Please sign in to comment.