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

Update 'by docket date distribution' to distribute non-genpop priorit… #23502

Open
wants to merge 2 commits into
base: feature/APPEALS-61385
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions app/models/concerns/by_docket_date_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@ def priority_push_distribution(limit)
@push_priority_target = limit
@rem = 0
@appeals = []
# Distribute <limit> number of cases, regardless of docket type, oldest first.
distribute_priority_appeals_from_all_dockets_by_age_to_limit(limit, style: "push")

if limit.nil?
# Distribute priority appeals that are tied to judges (not genpop) with no limit.
args = { priority: true, genpop: "not_genpop", style: "push", limit: limit }
dockets.each_key do |docket|
collect_appeals do
dockets[docket].distribute_appeals(self, args)
end
end
else
# Distribute <limit> number of cases, regardless of docket type, oldest first.
distribute_priority_appeals_from_all_dockets_by_age_to_limit(limit, style: "push")
end
@appeals
end

Expand Down
25 changes: 25 additions & 0 deletions spec/models/concerns/by_docket_date_distribution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,31 @@ def add_dates_to_date_array(num)
# priority_push_distribution is private so .send is used to directly call it
@new_acd.send :priority_push_distribution, 12
end

it "calls distribute_appeals for all the dockets and returns the array of objects received from each method" do
# distribute all priority appeals from all dockets
expect_any_instance_of(LegacyDocket).to receive(:distribute_appeals)
.with(@new_acd, priority: true, style: "push", limit: nil, genpop: "not_genpop")
.and_return(add_object_to_return_array(priority_count_hash[:legacy]))

expect_any_instance_of(DirectReviewDocket).to receive(:distribute_appeals)
.with(@new_acd, priority: true, style: "push", limit: nil, genpop: "not_genpop")
.and_return(add_object_to_return_array(priority_count_hash[:direct_review]))

expect_any_instance_of(EvidenceSubmissionDocket).to receive(:distribute_appeals)
.with(@new_acd, priority: true, style: "push", limit: nil, genpop: "not_genpop")
.and_return(add_object_to_return_array(priority_count_hash[:evidence_submission]))

expect_any_instance_of(HearingRequestDocket).to receive(:distribute_appeals)
.with(@new_acd, priority: true, style: "push", limit: nil, genpop: "not_genpop")
.and_return(add_object_to_return_array(priority_count_hash[:hearing]))

expect_any_instance_of(AojLegacyDocket).to receive(:distribute_appeals)
.with(@new_acd, priority: true, style: "push", limit: nil, genpop: "not_genpop")
.and_return(add_object_to_return_array(3))

@new_acd.send :priority_push_distribution, nil
end
end

let(:nonpriority_count_hash) { { legacy: 3, direct_review: 3, evidence_submission: 3, hearing: 3 } }
Expand Down
Loading