demarches-normaliennes/app/jobs/auto_archive_procedure_job.rb

14 lines
321 B
Ruby
Raw Normal View History

2017-10-03 16:19:25 +02:00
class AutoArchiveProcedureJob < ApplicationJob
queue_as :cron
def perform(*args)
2017-07-11 15:52:06 +02:00
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
procedure.dossiers.state_en_construction.each do |dossier|
dossier.en_instruction!
end
procedure.archive
end
end
end