Skip to content

Commit

Permalink
Merge pull request #20179 from department-of-veterans-affairs/hotfix/…
Browse files Browse the repository at this point in the history
…APPEALS-28734

hotfix/APPEALS-28734
  • Loading branch information
raymond-hughes authored Dec 21, 2023
2 parents 5339934 + dcb181a commit 74be2b3
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/serializers/work_queue/appeal_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ class WorkQueue::AppealSerializer

attribute :veteran_appellant_deceased, &:veteran_appellant_deceased?

attribute :assigned_to_location
attribute :assigned_to_location do |object, params|
if object&.status&.status == :distributed_to_judge
if params[:user]&.judge? || params[:user]&.attorney? || User.list_hearing_coordinators.include?(params[:user])
object.assigned_to_location
end
else
object.assigned_to_location
end
end

attribute :distributed_to_a_judge, &:distributed_to_a_judge?

Expand Down
68 changes: 68 additions & 0 deletions spec/fixes/assigned_to_search_results_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,72 @@
expect(appeal.root_task.status).to eq "completed"
end
end

context "appeal status is distributed to judge" do
let!(:appeal) { create(:appeal, :assigned_to_judge) }
let!(:default_user) { create(:default_user) }
let!(:hearings_coordinator_user) do
coordinator = create(:hearings_coordinator)
HearingsManagement.singleton.add_user(coordinator)
coordinator
end
let!(:attorney) do
attorney = create(:user)
create(:staff, :attorney_role, sdomainid: attorney.css_id)
attorney
end
let!(:judge) do
judge = create(:user)
create(:staff, :judge_role, sdomainid: judge.css_id)
judge
end

before do
allow_any_instance_of(BGSService).to receive(:fetch_file_number_by_ssn)
.with(appeal.veteran.ssn.to_s)
.and_return(appeal.veteran.file_number)
end
context "user is not an attorney, judge, or hearing coordinator" do
scenario "current user is a system admin" do
visit "/search?veteran_ids=#{appeal.veteran.id}"
expect(appeal.status.status).to eq :distributed_to_judge
expect(appeal.assigned_to_location).to eq "BVAAABSHIRE" # css_id is part of assigned_to
expect(page).not_to have_content("BVAAABSHIRE") # but css_id is not displayed in the page
end

scenario "current user is a default user" do
User.authenticate!(user: default_user)
visit "/search?veteran_ids=#{appeal.veteran.id}"
expect(appeal.status.status).to eq :distributed_to_judge
expect(appeal.assigned_to_location).to eq "BVAAABSHIRE" # css_id is part of assigned_to
expect(page).not_to have_content("BVAAABSHIRE") # but css_id is not displayed in the page
end
end

context "user is an attorney, a judge, or a hearing coordinator" do
scenario "user is an attorney" do
User.authenticate!(user: attorney)
visit "/search?veteran_ids=#{appeal.veteran.id}"
expect(appeal.status.status).to eq :distributed_to_judge
expect(appeal.assigned_to_location).to eq "BVAAABSHIRE" # css_id is part of assigned_to
expect(page).to have_content("BVAAABSHIRE") # and css_id is displayed in the page
end

scenario "user is an judge" do
User.authenticate!(user: judge)
visit "/search?veteran_ids=#{appeal.veteran.id}"
expect(appeal.status.status).to eq :distributed_to_judge
expect(appeal.assigned_to_location).to eq "BVAAABSHIRE" # css_id is part of assigned_to
expect(page).to have_content("BVAAABSHIRE") # and css_id is displayed in the page
end

scenario "user is an hearings coordinator" do
User.authenticate!(user: hearings_coordinator_user)
visit "/search?veteran_ids=#{appeal.veteran.id}"
expect(appeal.status.status).to eq :distributed_to_judge
expect(appeal.assigned_to_location).to eq "BVAAABSHIRE" # css_id is part of assigned_to
expect(page).to have_content("BVAAABSHIRE") # and css_id is displayed in the page
end
end
end
end

0 comments on commit 74be2b3

Please sign in to comment.