Prevent double processing of declarative dossiers

This commit is contained in:
Paul Chavard 2021-06-04 12:03:31 +02:00
parent 3bd6df8bbf
commit 1888f74b10
5 changed files with 24 additions and 7 deletions

View file

@ -606,10 +606,12 @@ class Procedure < ApplicationRecord
when Procedure.declarative_with_states.fetch(:en_instruction)
dossiers
.state_en_construction
.where(declarative_triggered_at: nil)
.find_each(&:passer_automatiquement_en_instruction!)
when Procedure.declarative_with_states.fetch(:accepte)
dossiers
.state_en_construction
.where(declarative_triggered_at: nil)
.find_each(&:accepter_automatiquement!)
end
end