2017-10-03 16:19:25 +02:00
|
|
|
class AutoArchiveProcedureJob < ApplicationJob
|
|
|
|
queue_as :cron
|
|
|
|
|
2017-03-15 12:40:59 +01:00
|
|
|
def perform(*args)
|
2017-07-11 15:52:06 +02:00
|
|
|
Procedure.publiees.where("auto_archive_on <= ?", Date.today).each do |procedure|
|
2018-11-27 11:13:37 +01:00
|
|
|
gestionnaire = procedure.gestionnaire_for_cron_job
|
|
|
|
|
|
|
|
procedure.dossiers.state_en_construction.find_each do |dossier|
|
|
|
|
dossier.passer_en_instruction!(gestionnaire)
|
|
|
|
end
|
2017-03-15 12:40:59 +01:00
|
|
|
|
2018-05-17 15:41:44 +02:00
|
|
|
procedure.archive!
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|