demarches-normaliennes/app/jobs/auto_archive_procedure_job.rb
2019-01-16 17:20:12 +01:00

14 lines
341 B
Ruby

class AutoArchiveProcedureJob < ApplicationJob
queue_as :cron
def perform(*args)
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
procedure
.dossiers
.state_en_construction
.find_each(&:passer_automatiquement_en_instruction!)
procedure.archive!
end
end
end