l'expert ne voit pas les dossiers supprimés par l'instructeur
This commit is contained in:
parent
051d7b2028
commit
b408811c5a
3 changed files with 4 additions and 4 deletions
|
@ -12,13 +12,13 @@ module Experts
|
|||
DONNES_STATUS = 'donnes'
|
||||
|
||||
def index
|
||||
avis = current_expert.avis.includes(dossier: [groupe_instructeur: :procedure])
|
||||
avis = current_expert.avis.includes(dossier: [groupe_instructeur: :procedure]).not_hidden_by_administration
|
||||
@avis_by_procedure = avis.to_a.group_by(&:procedure)
|
||||
end
|
||||
|
||||
def procedure
|
||||
@procedure = Procedure.find(params[:procedure_id])
|
||||
expert_avis = current_expert.avis.includes(:dossier).where(dossiers: { groupe_instructeur: GroupeInstructeur.where(procedure: @procedure.id) })
|
||||
expert_avis = current_expert.avis.includes(:dossier).not_hidden_by_administration.where(dossiers: { groupe_instructeur: GroupeInstructeur.where(procedure: @procedure.id) })
|
||||
@avis_a_donner = expert_avis.without_answer
|
||||
@avis_donnes = expert_avis.with_answer
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class Avis < ApplicationRecord
|
|||
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
||||
scope :discarded_termine_expired, -> { unscope(:joins).where(dossier: Dossier.discarded_termine_expired) }
|
||||
scope :discarded_en_construction_expired, -> { unscope(:joins).where(dossier: Dossier.discarded_en_construction_expired) }
|
||||
|
||||
scope :not_hidden_by_administration, -> { where(dossiers: { hidden_by_administration_at: nil }) }
|
||||
# The form allows subtmitting avis requests to several emails at once,
|
||||
# hence this virtual attribute.
|
||||
attr_accessor :emails
|
||||
|
|
|
@ -29,7 +29,7 @@ class Expert < ApplicationRecord
|
|||
@avis_summary
|
||||
else
|
||||
query = <<~EOF
|
||||
COUNT(*) FILTER (where answer IS NULL) AS unanswered,
|
||||
COUNT(*) FILTER (where answer IS NULL AND dossiers.hidden_by_instructeur_at IS NULL) AS unanswered,
|
||||
COUNT(*) AS total
|
||||
EOF
|
||||
result = avis.select(query)[0]
|
||||
|
|
Loading…
Reference in a new issue