Skip to content

Commit

Permalink
ACD: Disable Legacy Docket and Non Priority distribution (#18463)
Browse files Browse the repository at this point in the history
* Update by_docket_date_distribution.rb

* Update docket_coordinator.rb

* disable Legacy

* add feature toggle indicators to stats

* Update by_docket_date_distribution.rb

* Update push_priority_appeals_to_judges_job.rb
  • Loading branch information
zurbergram authored and KiMauVA committed Apr 21, 2023
1 parent 163fab4 commit 7693361
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
8 changes: 7 additions & 1 deletion app/jobs/push_priority_appeals_to_judges_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def slack_report
docket_coordinator.dockets.each_pair do |sym, docket|
report << "*Number of #{sym} appeals _not_ distributed*: #{docket.count(priority: true, ready: true)}"
end
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"
unless disable_legacy?
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"
end

report << ""
report << "*Debugging information*"
Expand Down Expand Up @@ -179,6 +181,10 @@ def use_by_docket_date?
FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user])
end

def disable_legacy?
FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
end

def legacy_not_genpop_count
docket_coordinator.dockets[:legacy].not_genpop_priority_count
end
Expand Down
22 changes: 17 additions & 5 deletions app/models/concerns/by_docket_date_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def requested_distribution
priority_rem = priority_target.clamp(0, @rem)
distribute_priority_appeals_from_all_dockets_by_age_to_limit(priority_rem, style: "request")

# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem) until @rem <= 0
unless FeatureToggle.enabled?(:acd_disable_nonpriority_distributions, user: RequestStore.store[:current_user])
# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem) until @rem <= 0
end
@appeals
end

Expand Down Expand Up @@ -57,17 +59,27 @@ def ama_statistics
nonpriority_counts[sym] = docket.count(priority: false, ready: true)
end

priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)
unless FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)
end

nonpriority_counts[:iterations] = @nonpriority_iterations

settings = {}
feature_toggles = [:acd_disable_legacy_distributions, :acd_disable_nonpriority_distributions]
feature_toggles.each do |sym|
settings[sym] = FeatureToggle.enabled?(sym, user: RequestStore.store[:current_user])
end

{
batch_size: @appeals.count,
total_batch_size: total_batch_size,
priority_target: @push_priority_target || @request_priority_count,
priority: priority_counts,
nonpriority: nonpriority_counts,
algorithm: "by_docket_date"
algorithm: "by_docket_date",
settings: settings
}
end

Expand Down
2 changes: 2 additions & 0 deletions app/models/distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def judge_tasks
end

def judge_legacy_tasks
return [] if FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])

legacy_tasks = QueueRepository.tasks_for_user(judge.css_id)

@judge_legacy_tasks ||= legacy_tasks.select { |task| task.assigned_to_attorney_date.nil? }
Expand Down
8 changes: 7 additions & 1 deletion app/models/docket_coordinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

class DocketCoordinator
def dockets
@dockets ||= {
all_dockets = {
legacy: LegacyDocket.new,
direct_review: DirectReviewDocket.new,
evidence_submission: EvidenceSubmissionDocket.new,
hearing: HearingRequestDocket.new
}

if FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
all_dockets.delete(:legacy)
end

@dockets ||= all_dockets
end

def docket_proportions
Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
t.boolean "appeal_docketed", default: false, null: false, comment: "When true, appeal has been docketed"
t.bigint "appeal_id", null: false, comment: "AMA or Legacy Appeal ID"
t.string "appeal_type", null: false, comment: "Appeal Type (Appeal or LegacyAppeal)"
t.datetime "created_at", null: false, comment: "Date and Time the record was inserted into the table"
t.datetime "created_at", null: false
t.bigint "created_by_id", null: false, comment: "User id of the user that inserted the record"
t.boolean "decision_mailed", default: false, null: false, comment: "When true, appeal has decision mail request complete"
t.boolean "hearing_postponed", default: false, null: false, comment: "When true, appeal has hearing postponed and no hearings scheduled"
Expand All @@ -100,7 +100,7 @@
t.boolean "privacy_act_complete", default: false, null: false, comment: "When true, appeal has a privacy act request completed"
t.boolean "privacy_act_pending", default: false, null: false, comment: "When true, appeal has a privacy act request still open"
t.boolean "scheduled_in_error", default: false, null: false, comment: "When true, hearing was scheduled in error and none scheduled"
t.datetime "updated_at", comment: "Date and time the record was last updated"
t.datetime "updated_at"
t.bigint "updated_by_id", comment: "User id of the last user that updated the record"
t.boolean "vso_ihp_complete", default: false, null: false, comment: "When true, appeal has a VSO IHP request completed"
t.boolean "vso_ihp_pending", default: false, null: false, comment: "When true, appeal has a VSO IHP request pending"
Expand Down

0 comments on commit 7693361

Please sign in to comment.