Skip to content

Commit

Permalink
CASEFLOW-138 Propagate task instructions when task is bulk assigned (#…
Browse files Browse the repository at this point in the history
…15899)

Resolves [CASEFLOW-138](https://vajira.max.gov/browse/CASEFLOW-138)

### Description
Propagate task instructions when task is bulk assigned


### Acceptance Criteria
- [ ] Task Instructions Remain When Task is Bulk Assigned

### Testing Plan
(See Testing Plan in #15125. Borrowed from Testing Plan in #14523, except include instructions and check for instructions in newly assigned tasks.)

1. Make Jolly Postman an admin
   ```ruby
   OrganizationsUser.make_user_admin(User.find_by(css_id: "JOLLY_POSTMAN"), MailTeam.singleton)
   ```
1. Log in as jolly postman and go to the mail team queue
1. Go to Case Details for one of the Unassigned cases and grab the UUID from the URL
1. Add instructions to the active task of the selected appeal:
```ruby
t=Task.find(NNN)
t.update(instructions: ["do good"])
```
1. Refresh Case Details and click View Instructions to see the instruction.
1. Back in the queue view, click "Assign tasks"
1. Assign some tasks to a user. Set the filters so that the case you modified will be bulk assigned.
1. Confirm tasks were assigned to the user. See the Assigned tab.
1. Open the appeal you modified to ensure the instructions propagated to the new user-task. Check the task instructions in the task tree:
```ruby
t.children.active.first.instructions
```

Perform the same Testing Plan in the `master` branch and check that `instructions` are not propagated.

### User Facing Changes

 BEFORE|AFTER
 ---|---
![image](https://user-images.githubusercontent.com/55255674/107680554-9c9c8e80-6c63-11eb-9b2b-2641dcac359f.png) | ![image](https://user-images.githubusercontent.com/55255674/107680242-36177080-6c63-11eb-869c-78c0cfcc5f81.png)
  • Loading branch information
yoomlam authored Feb 17, 2021
1 parent c2a8830 commit cf65c2a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/workflows/bulk_task_assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def process
Task.create!(
type: task_type,
appeal: task.appeal,
instructions: task.instructions,
assigned_by: assigned_by,
parent: task,
assigned_to: assigned_to
Expand Down
33 changes: 33 additions & 0 deletions spec/workflows/bulk_task_assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,39 @@ def create_no_show_hearing_task_for_appeal(appeal)
create(:no_show_hearing_task, appeal: appeal, assigned_to: organization)
end

context "when task has instructions" do
subject { BulkTaskAssignment.new(params).process }

let(:instructions1) { ["live long"] }
let(:instructions2) { ["prosper"] }

before do
no_show_hearing_task1.update(instructions: instructions1)
no_show_hearing_task2.update(instructions: instructions2)
end

it "copies instructions to assigned task" do
count_before = Task.count
subject
expect(Task.count).to eq count_before + 2
expect(subject.count).to eq 2

user_task_1 = subject.find { |task| task.appeal == no_show_hearing_task1.appeal }
expect(user_task_1.assigned_to).to eq assigned_to
expect(user_task_1.type).to eq "NoShowHearingTask"
expect(user_task_1.assigned_by).to eq assigned_by
expect(user_task_1.parent_id).to eq no_show_hearing_task1.id
expect(user_task_1.instructions).to eq no_show_hearing_task1.instructions

user_task_2 = subject.find { |task| task.appeal == no_show_hearing_task2.appeal }
expect(user_task_2.assigned_to).to eq assigned_to
expect(user_task_2.type).to eq "NoShowHearingTask"
expect(user_task_2.assigned_by).to eq assigned_by
expect(user_task_2.parent_id).to eq no_show_hearing_task2.id
expect(user_task_2.instructions).to eq no_show_hearing_task2.instructions
end
end

context "when there are priority appeals" do
let(:regional_office) { nil }
let(:task_count) { 20 }
Expand Down

0 comments on commit cf65c2a

Please sign in to comment.