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

APPEALS-56980 Fix for .perform_later functionality in higher environm… #22671

Merged
merged 4 commits into from
Aug 30, 2024
Merged
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
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
Loading