demarches-normaliennes/app/jobs/auto_archive_procedure_job.rb
2018-10-03 12:15:48 +02:00

11 lines
286 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.each(&:en_instruction!)
procedure.archive!
end
end
end