Skip to content

Commit

Permalink
Enable bulk assign for test orgs (#14523)
Browse files Browse the repository at this point in the history
Bumps #14124

### Description
Bulk assign is enabled for the orgs listed here

### Acceptance Criteria
- [ ] Bulk assignment can be accessed buy the following orgs:
  - [ ] Mail Team
   - [ ] Privacy Team
   - [ ] Transcription Team
   - [ ] American Legion
   - [ ] Disabled American Veterans
   - [ ] Veterans of Foreign Wars

### Testing Plan
#### Mail team (the only team in dev that has unassigned 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. Confirm they have the bulk "Assign tasks" button
1. Click "Assign tasks"
1. Assign some tasks to a user
1. Confirm tasks were assigned to the user.
#### VSO
1. Sign in as team admin
1. Got to the Caseflow team management page from your dropdown
1. Create Disabled American Veterans vso with the participant id 2452415
<img width="510" alt="Screen Shot 2020-06-12 at 11 29 05 AM" src="https://user-images.githubusercontent.com/45575454/84519363-fb0e0900-ac9f-11ea-9175-9f36913a2d6f.png">
1. Add Billie VSO to the DAV and make them an admin
<img width="869" alt="Screen Shot 2020-06-12 at 11 23 31 AM" src="https://user-images.githubusercontent.com/45575454/84518762-2d6b3680-ac9f-11ea-8aa5-c59c3fab0c9a.png">
1. Log in as that user and navigate to the dva org page
1. Ensure they have the bulk assign button
<img width="733" alt="Screen Shot 2020-06-12 at 11 30 31 AM" src="https://user-images.githubusercontent.com/45575454/84519510-33ade280-aca0-11ea-8a68-34e148c53c40.png">

### User Facing Changes

 BEFORE|AFTER BUTTON|AFTER MODAL
 ---|---|---
![Screen Shot 2020-06-10 at 11 29 33 AM](https://user-images.githubusercontent.com/45575454/84287260-adfa2d80-ab0d-11ea-9639-b5556a833a2b.png)|![Screen Shot 2020-06-10 at 4 17 11 PM](https://user-images.githubusercontent.com/45575454/84314348-e4e43980-ab35-11ea-9f97-87f5a50ed117.png)|![Screen Shot 2020-06-10 at 4 17 19 PM](https://user-images.githubusercontent.com/45575454/84314355-e877c080-ab35-11ea-8318-1e9bd4aa4d4a.png)



AFTER VALIDATION|AFTER ASSIGNEE|AFTER REGIONAL OFFICE|AFTER TASK TYPES|AFTER TASK COUNT
---|---|---|---|---
![Screen Shot 2020-06-10 at 11 47 00 AM](https://user-images.githubusercontent.com/45575454/84289178-2cf06580-ab10-11ea-99c5-80fd751d8d77.png)|![Screen Shot 2020-06-10 at 11 47 08 AM](https://user-images.githubusercontent.com/45575454/84289188-2eba2900-ab10-11ea-9cfa-901345b7d43d.png)|![Screen Shot 2020-06-10 at 11 47 13 AM](https://user-images.githubusercontent.com/45575454/84289193-2feb5600-ab10-11ea-972e-c0560bd87124.png)|![Screen Shot 2020-06-10 at 11 47 17 AM](https://user-images.githubusercontent.com/45575454/84289198-31b51980-ab10-11ea-990e-9246336d4b18.png)|![Screen Shot 2020-06-10 at 11 47 22 AM](https://user-images.githubusercontent.com/45575454/84289202-32e64680-ab10-11ea-9401-8c2405728177.png)
  • Loading branch information
hschallhorn authored Jun 16, 2020
1 parent 076e82a commit b05c8a7
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 13 deletions.
4 changes: 4 additions & 0 deletions app/models/organizations/mail_team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ def self.singleton
def users_can_create_mail_task?
true
end

def can_bulk_assign_tasks?
true
end
end
4 changes: 4 additions & 0 deletions app/models/organizations/privacy_team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ class PrivacyTeam < Organization
def self.singleton
PrivacyTeam.first || PrivacyTeam.create(name: "Privacy Team", url: "privacy")
end

def can_bulk_assign_tasks?
true
end
end
4 changes: 4 additions & 0 deletions app/models/organizations/transcription_team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ class TranscriptionTeam < Organization
def self.singleton
TranscriptionTeam.first || TranscriptionTeam.create(name: "Transcription", url: "transcription")
end

def can_bulk_assign_tasks?
true
end
end
12 changes: 11 additions & 1 deletion app/models/organizations/vso.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# frozen_string_literal: true

class Vso < Representative; end
class Vso < Representative
def can_bulk_assign_tasks?
bulk_assign_vso_names = [
"American Legion",
"Disabled American Veterans",
"Veterans of Foreign Wars"
]

Vso.where(name: bulk_assign_vso_names).include?(self)
end
end
50 changes: 38 additions & 12 deletions spec/workflows/bulk_task_assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@
end
end

shared_examples "valid bulk assign" do
it "bulk assigns tasks" do
count_before = Task.count
bulk_assignment = BulkTaskAssignment.new(params)
expect(bulk_assignment.valid?).to eq true
result = bulk_assignment.process
expect(Task.count).to eq count_before + 2
expect(result.count).to eq 2
expect(result.first.assigned_to).to eq assigned_to
expect(result.first.type).to eq "NoShowHearingTask"
expect(result.first.assigned_by).to eq assigned_by
expect(result.first.appeal).to eq no_show_hearing_task1.appeal
expect(result.first.parent_id).to eq no_show_hearing_task1.id
end
end

context "when assigned to user does not belong to organization" do
let(:assigned_to_param) { create(:user) }
let(:error) { "does not belong to organization with url #{organization.url}" }
Expand Down Expand Up @@ -111,18 +127,28 @@
end

context "when all attributes are present" do
it "bulk assigns tasks" do
count_before = Task.count
bulk_assignment = BulkTaskAssignment.new(params)
expect(bulk_assignment.valid?).to eq true
result = bulk_assignment.process
expect(Task.count).to eq count_before + 2
expect(result.count).to eq 2
expect(result.first.assigned_to).to eq assigned_to
expect(result.first.type).to eq "NoShowHearingTask"
expect(result.first.assigned_by).to eq assigned_by
expect(result.first.appeal).to eq no_show_hearing_task1.appeal
expect(result.first.parent_id).to eq no_show_hearing_task1.id
it_behaves_like "valid bulk assign"

context "when the org is not hearings management" do
context "when the org is the mail team" do
let(:organization) { MailTeam.singleton }

it_behaves_like "valid bulk assign"
end

context "when the org is a vso" do
let(:organization) { create(:vso, name: "VSO that cannot bulk assign") }
let(:error) { "with url #{organization_url} cannot bulk assign tasks" }
let(:error_sym) { :organization }

it_behaves_like "invalid bulk assign"

context "when the vso is American Legion" do
let(:organization) { create(:vso, name: "American Legion") }

it_behaves_like "valid bulk assign"
end
end
end

context "when there are legacy appeals and regional office is passed" do
Expand Down

0 comments on commit b05c8a7

Please sign in to comment.