fix(instructeur): set notification settings on all groupe instruteur for given procedure

This commit is contained in:
Paul Chavard 2021-12-21 17:25:14 +00:00 committed by Pierre de La Morinerie
parent a180985fb7
commit 2f6cd317bf

View file

@ -216,11 +216,13 @@ module Instructeurs
def email_notifications
@procedure = procedure
@assign_to = assign_to
@assign_to = assign_tos.first
end
def update_email_notifications
assign_to.update!(assign_to_params)
assign_tos.each do |assign_to|
assign_to.update!(assign_to_params)
end
flash.notice = 'Vos notifications sont enregistrées.'
redirect_to instructeur_procedure_path(procedure)
end
@ -290,10 +292,6 @@ module Instructeurs
@exports = Export.find_for_groupe_instructeurs(groupe_instructeur_ids)
end
def assign_to
current_instructeur.assign_to.joins(:groupe_instructeur).find_by(groupe_instructeurs: { procedure: procedure })
end
def assign_tos
@assign_tos ||= current_instructeur
.assign_to