2017-03-15 12:40:59 +01:00
|
|
|
class AutoArchiveProcedureWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
def perform(*args)
|
2017-05-26 19:35:02 +02:00
|
|
|
Procedure.not_archived.where("auto_archive_on <= ?", Date.today).each do |procedure|
|
2017-05-26 19:42:05 +02:00
|
|
|
procedure.dossiers.state_en_construction.each do |dossier|
|
|
|
|
dossier.received!
|
|
|
|
end
|
2017-03-15 12:40:59 +01:00
|
|
|
|
2017-05-26 19:35:02 +02:00
|
|
|
procedure.update_attributes!(archived: true)
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|