2017-03-15 12:40:59 +01:00
|
|
|
class AutoArchiveProcedureWorker
|
|
|
|
def perform(*args)
|
2017-09-26 14:12:55 +02:00
|
|
|
Rails.logger.info("AutoArchiveProcedureWorker started at #{Time.now}")
|
2017-07-11 15:52:06 +02:00
|
|
|
Procedure.publiees.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-06-27 16:57:25 +02:00
|
|
|
procedure.archive
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|
2017-09-26 14:12:55 +02:00
|
|
|
Rails.logger.info("AutoArchiveProcedureWorker ended at #{Time.now}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def queue_name
|
|
|
|
"cron"
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|
2017-09-26 14:12:55 +02:00
|
|
|
|
|
|
|
handle_asynchronously :perform
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|