refactor: mutualize email_expert logic

This commit is contained in:
simon lehericey 2024-04-16 11:12:32 +02:00
parent 71b0592b0a
commit 5cd780251b
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
5 changed files with 42 additions and 31 deletions

View file

@ -29,6 +29,14 @@ class Expert < ApplicationRecord
end
end
def self.autocomplete_mails(procedure)
if procedure.experts_require_administrateur_invitation?
procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort
else
procedure.experts.map(&:email).sort
end
end
def merge(old_expert)
return if old_expert.nil?