demarches-normaliennes/app/jobs/auto_archive_procedure_job.rb

15 lines
346 B
Ruby
Raw Normal View History

2017-10-03 16:19:25 +02:00
class AutoArchiveProcedureJob < ApplicationJob
queue_as :cron
def perform(*args)
Procedure.publiees.where("auto_archive_on <= ?", Time.zone.today).each do |procedure|
procedure
.dossiers
.state_en_construction
.find_each(&:passer_automatiquement_en_instruction!)
2018-05-17 15:41:44 +02:00
procedure.archive!
end
end
end