2020-03-28 16:49:40 +01:00
|
|
|
class AutoArchiveProcedureJob < CronJob
|
2020-04-01 15:26:46 +02:00
|
|
|
self.schedule_expression = "every 1 minute"
|
2017-10-03 16:19:25 +02:00
|
|
|
|
2017-03-15 12:40:59 +01:00
|
|
|
def perform(*args)
|
2019-11-12 03:14:27 +01:00
|
|
|
Procedure.publiees.where("auto_archive_on <= ?", Time.zone.today).each do |procedure|
|
2019-01-16 10:47:32 +01:00
|
|
|
procedure
|
|
|
|
.dossiers
|
|
|
|
.state_en_construction
|
|
|
|
.find_each(&:passer_automatiquement_en_instruction!)
|
2017-03-15 12:40:59 +01:00
|
|
|
|
2019-11-14 09:43:45 +01:00
|
|
|
procedure.close!
|
2017-03-15 12:40:59 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|