bug(compteurs.avis.a.donner): ETQ expert, je ne souhaite pas avoir a donner un avis sur un dossier termine
This commit is contained in:
parent
1417d0e873
commit
d2e30911f7
3 changed files with 17 additions and 4 deletions
|
@ -13,7 +13,10 @@ module Experts
|
|||
DONNES_STATUS = 'donnes'
|
||||
|
||||
def index
|
||||
avis = current_expert.avis.not_revoked.includes(dossier: [groupe_instructeur: :procedure]).not_hidden_by_administration
|
||||
avis = current_expert.avis
|
||||
.not_revoked
|
||||
.includes(dossier: [groupe_instructeur: :procedure])
|
||||
.not_hidden_by_administration
|
||||
@avis_by_procedure = avis.to_a.group_by(&:procedure)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
%ul.procedure-list
|
||||
- @avis_by_procedure.each do |p, procedure_avis|
|
||||
%li.procedure-item.flex.align-start.fr-my-3w.fr-p-2w
|
||||
%li.procedure-item.flex.align-start.fr-my-3w.fr-p-2w{ id: dom_id(p) }
|
||||
.flex
|
||||
= link_to instructeur_procedure_path(p), class: 'procedure-logo-link' do
|
||||
.procedure-logo{ style: "background-image: url(#{p.logo_url})" }
|
||||
|
@ -16,7 +16,7 @@
|
|||
= link_to(p.libelle, procedure_expert_avis_index_path(p), class: "fr-link fr-ml-1w")
|
||||
|
||||
%ul.procedure-stats.flex
|
||||
%li
|
||||
%li.avis-a-donner
|
||||
%object
|
||||
= link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::A_DONNER_STATUS)) do
|
||||
- without_answer_count = procedure_avis.select { |a| a.answer.nil? }.size
|
||||
|
@ -26,7 +26,7 @@
|
|||
= without_answer_count
|
||||
.stats-legend
|
||||
avis à donner
|
||||
%li
|
||||
%li.avis-donne
|
||||
%object
|
||||
= link_to(procedure_expert_avis_index_path(p, statut: Instructeurs::AvisController::DONNES_STATUS)) do
|
||||
- with_answer_count = procedure_avis.select { |a| a.answer.present? }.size
|
||||
|
|
|
@ -17,6 +17,16 @@ describe 'experts/avis/index', type: :view do
|
|||
expect(subject).to have_text("avis à donner")
|
||||
end
|
||||
|
||||
context 'dossier is termine' do
|
||||
before do
|
||||
avis.dossier.update!(state: "accepte")
|
||||
end
|
||||
|
||||
it 'doesn’t count avis a donner when dossier is termine' do
|
||||
expect(subject).to have_selector("##{dom_id(procedure)} .avis-a-donner .stats-number", text: 0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the dossier is deleted by instructeur' do
|
||||
before do
|
||||
avis.dossier.update!(state: "accepte", hidden_by_administration_at: Time.zone.now.beginning_of_day.utc)
|
||||
|
|
Loading…
Reference in a new issue