demarches-normaliennes/app/jobs/auto_archive_procedure_job.rb
2020-03-31 12:25:46 +02:00

14 lines
357 B
Ruby

class AutoArchiveProcedureJob < CronJob
self.cron_expression = "* * * * *"
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!)
procedure.close!
end
end
end