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,15 +535,11 @@ class Dossier < ApplicationRecord
end
def avis_for_expert(expert)
if expert.dossiers.include?(self)
avis.order(created_at: :asc)
else
avis
.where(confidentiel: false)
.or(avis.where(claimant: expert))
Avis
.where(dossier_id: id, confidentiel: false)
.or(Avis.where(id: expert.avis))
.order(created_at: :asc)
end
end
def owner_name
if etablissement.present?