Skip to content

Commit

Permalink
Add argument for call within sync_review_job.rb and minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
msteele96 committed Aug 30, 2024
1 parent e983678 commit 0e478a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/jobs/sync_reviews_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def perform_decision_rating_issues_syncs(limit)

def reprocess_decision_documents(limit)
DecisionDocument.requires_processing.limit(limit).each do |decision_document|
ProcessDecisionDocumentJob.perform_later(decision_document.id)
ProcessDecisionDocumentJob.perform_later(decision_document.id, decision_document.for_contested_claim?)
end
end
end
18 changes: 11 additions & 7 deletions app/models/decision_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,8 @@ def submit_for_processing!(delay: processing_delay)
# Below we're grabbing the boolean value at this point in time.
# This will act as a point of truth that wont be affected by the
# async behavior of the outcode function due to triggering jobs.
case appeal_type
when "Appeal"
contested = appeal.contested_claim?
when "LegacyAppeal"
contested = appeal.contested_claim
end
ProcessDecisionDocumentJob.perform_later(id, contested, mail_package)

ProcessDecisionDocumentJob.perform_later(id, for_contested_claim?, mail_package)
end
end

Expand Down Expand Up @@ -127,6 +122,15 @@ def all_contention_records(epe)
contention_records(epe)
end

def for_contested_claim?
case appeal_type
when "Appeal"
return appeal.contested_claim?
when "LegacyAppeal"
return appeal.contested_claim
end
end

private

attr_reader :mail_package
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/sync_reviews_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
SyncReviewsJob.perform_now
end.to have_enqueued_job(
ProcessDecisionDocumentJob
).with(decision_document_needs_reprocessing.id).exactly(:once)
).with(decision_document_needs_reprocessing.id, false).exactly(:once)
end
end
end
Expand Down

0 comments on commit 0e478a9

Please sign in to comment.