sul-dlss/pre-assembly

View on GitHub
app/jobs/job_run_complete_job.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

# Updates a JobRun if all Accessions are complete
class JobRunCompleteJob < ApplicationJob
  def perform(job_run)
    return if job_run.running? ||
              job_run.accessioning_complete? ||
              job_run.accessions.empty? ||
              job_run.accessions.exists?(state: :in_progress)

    job_run.accessioning_completed
  end
end