demarches-normaliennes/app/jobs/cron/auto_archive_procedure_job.rb

15 lines
378 B
Ruby
Raw Normal View History

class Cron::AutoArchiveProcedureJob < Cron::CronJob
self.schedule_expression = "every 1 minute"
2017-10-03 16:19:25 +02:00
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