Skip to content

Commit

Permalink
updates to age_of_n_oldest_nonpriority method
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahsaucedo committed Aug 15, 2024
1 parent 50c63d7 commit ffbb80d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions app/models/vacols/aoj_case_docket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,38 @@ def self.age_of_n_oldest_nonpriority_appeals_available_to_judge(judge, num)
nonpriority_cdl_aoj_query = generate_nonpriority_case_distribution_lever_aoj_query(aoj_affinity_lever_value)
conn = connection

query = <<-SQL
query = if aoj_affinity_lever_value == Constants.ACD_LEVERS.infinite
<<-SQL
#{SELECT_NONPRIORITY_APPEALS_ORDER_BY_BFD19}
where ((VLJ = ? or #{ineligible_judges_sattyid_cache} or VLJ is null)
and ((PREV_TYPE_ACTION is null or PREV_TYPE_ACTION <> '7') and AOD = '0')
or ((PREV_DECIDING_JUDGE = ? or #{ineligible_judges_sattyid_cache(true)}
or #{vacols_judges_with_exclude_appeals_from_affinity(excluded_judges_attorney_ids)})
or #{nonpriority_cdl_aoj_query})
SQL
SQL
else
<<-SQL
#{SELECT_NONPRIORITY_APPEALS_ORDER_BY_BFD19}
where ((VLJ = ? or #{ineligible_judges_sattyid_cache} or VLJ is null)
and ((PREV_TYPE_ACTION is null or PREV_TYPE_ACTION <> '7') and AOD = '0')
or #{nonpriority_cdl_aoj_query})
SQL
end

fmtd_query = sanitize_sql_array([
fmtd_query = if aoj_affinity_lever_value != Constants.ACD_LEVERS.infinite
sanitize_sql_array([
query,
judge.vacols_attorney_id,
judge.vacols_attorney_id
judge.vacols_attorney_id,
num
])
else
sanitize_sql_array([
query,
judge.vacols_attorney_id,
num
])
end

appeals = conn.exec_query(fmtd_query).to_a

Expand Down

0 comments on commit ffbb80d

Please sign in to comment.