demarches-normaliennes/app/workers/auto_archive_procedure_worker.rb
2017-07-03 10:18:48 +02:00

13 lines
314 B
Ruby

class AutoArchiveProcedureWorker
include Sidekiq::Worker
def perform(*args)
Procedure.not_archived.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