demarches-normaliennes/app/workers/auto_archive_procedure_worker.rb

14 lines
310 B
Ruby
Raw Normal View History

class AutoArchiveProcedureWorker
include Sidekiq::Worker
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.received!
end
procedure.archive
end
end
end