Skip to content

Commit

Permalink
APPEALS-56980 Fix for .perform_later functionality in higher environm… (
Browse files Browse the repository at this point in the history
#22671)

* APPEALS-56980 Fix for .perform_later functionality in higher environments

* Remove lines of code that aren't needed and add built in checker

* Fix 1 of 2 errors

* Move local variables out of intialize or callback methods

---------

Co-authored-by: Christopher Detlef <>
  • Loading branch information
cdetlefva authored Aug 30, 2024
1 parent 7a510c3 commit 2a9e100
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions app/jobs/return_legacy_appeals_to_board_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,19 @@
class ReturnLegacyAppealsToBoardJob < CaseflowJob
# For time_ago_in_words()
include ActionView::Helpers::DateHelper
# include RunAsyncable

queue_as :low_priority
queue_with_priority :low_priority
application_attr :queue

def initialize
@no_records_found_message = [Constants.DISTRIBUTION.no_records_moved_message].freeze
@nonsscavlj_number_of_appeals_limit = CaseDistributionLever.nonsscavlj_number_of_appeals_to_move || 0
@nonsscavlj_number_of_appeals_to_move = @nonsscavlj_number_of_appeals_limit - 1
end
NO_RECORDS_FOUND_MESSAGE = [Constants.DISTRIBUTION.no_records_moved_message].freeze

def perform
begin
returned_appeal_job = create_returned_appeal_job

appeals, moved_appeals = eligible_and_moved_appeals

return send_job_slack_report(@no_records_found_message) if moved_appeals.nil?
return send_job_slack_report(NO_RECORDS_FOUND_MESSAGE) if moved_appeals.nil?

complete_returned_appeal_job(returned_appeal_job, "Job completed successfully", moved_appeals)

Expand Down Expand Up @@ -115,10 +110,10 @@ def get_tied_appeal_bfkeys(tied_appeals)

def update_qualifying_appeals_bfkeys(tied_appeals_bfkeys, qualifying_appeals_bfkeys)
if tied_appeals_bfkeys.any?
if tied_appeals_bfkeys.count < @nonsscavlj_number_of_appeals_limit
if tied_appeals_bfkeys.count < nonsscavlj_number_of_appeals_limit
qualifying_appeals_bfkeys.push(tied_appeals_bfkeys)
else
qualifying_appeals_bfkeys.push(tied_appeals_bfkeys[0..@nonsscavlj_number_of_appeals_to_move])
qualifying_appeals_bfkeys.push(tied_appeals_bfkeys[0..max_appeals_limit_index])
end
end

Expand All @@ -129,6 +124,14 @@ def non_ssc_avljs
VACOLS::Staff.where("sactive = 'A' AND svlj = 'A' AND sattyid <> smemgrp")
end

def nonsscavlj_number_of_appeals_limit
@nonsscavlj_number_of_appeals_limit ||= (CaseDistributionLever.nonsscavlj_number_of_appeals_to_move || 0)
end

def max_appeals_limit_index
nonsscavlj_number_of_appeals_limit - 1
end

# Method to separate appeals by priority
def separate_by_priority(appeals)
return [] if appeals.nil?
Expand Down

0 comments on commit 2a9e100

Please sign in to comment.