Further refactor of AutoArchiveProcedureWorker

Call received! so that validation and save
callbacks are called.

Previously, we wouldn’t have update the
received_at date
This commit is contained in:
gregoirenovel 2017-05-26 19:42:05 +02:00
parent cc95216672
commit 67d0fb5ddc

View file

@ -3,7 +3,9 @@ class AutoArchiveProcedureWorker
def perform(*args)
Procedure.not_archived.where("auto_archive_on <= ?", Date.today).each do |procedure|
procedure.dossiers.state_en_construction.update_all(state: :received)
procedure.dossiers.state_en_construction.each do |dossier|
dossier.received!
end
procedure.update_attributes!(archived: true)
end