do not display confidential avis to other experts

This commit is contained in:
kara Diaby 2021-05-19 15:41:12 +02:00
parent 8134fa389c
commit 20933579b0

View file

@ -535,14 +535,10 @@ class Dossier < ApplicationRecord
end end
def avis_for_expert(expert) def avis_for_expert(expert)
if expert.dossiers.include?(self) Avis
avis.order(created_at: :asc) .where(dossier_id: id, confidentiel: false)
else .or(Avis.where(id: expert.avis))
avis .order(created_at: :asc)
.where(confidentiel: false)
.or(avis.where(claimant: expert))
.order(created_at: :asc)
end
end end
def owner_name def owner_name