send notif only to the right instructeurs

after a dossier creation, only the instructeurs that belong to the group
instructeur of the dossier, and who want notif will be notified by mail
This commit is contained in:
Christophe Robillard 2020-04-23 11:52:21 +02:00
parent d927118221
commit 339066778d
3 changed files with 29 additions and 3 deletions

View file

@ -1,7 +1,11 @@
FactoryBot.define do
factory :assign_to do
after(:build) do |assign_to, _evaluator|
assign_to.groupe_instructeur = assign_to.procedure.defaut_groupe_instructeur
after(:build) do |assign_to, evaluator|
if evaluator.groupe_instructeur.persisted?
assign_to.groupe_instructeur = evaluator.groupe_instructeur
else
assign_to.groupe_instructeur = assign_to.procedure.defaut_groupe_instructeur
end
end
end
end