Merge pull request #8155 from tchak/fix-procedure-overview

fix(dossier): exclue les dossier du résumé de la démarche
This commit is contained in:
LeSim 2022-11-29 16:48:06 +01:00 committed by GitHub
commit 23b9b893bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -10,7 +10,7 @@ class ProcedureOverview
@start_date = start_date @start_date = start_date
@procedure = procedure @procedure = procedure
dossiers = procedure.dossiers.where(groupe_instructeur: groups) dossiers = procedure.dossiers.where(groupe_instructeur: groups).visible_by_administration
@dossiers_en_instruction_count = dossiers.state_en_instruction.count @dossiers_en_instruction_count = dossiers.state_en_instruction.count
@old_dossiers_en_instruction = dossiers @old_dossiers_en_instruction = dossiers
@ -24,7 +24,6 @@ class ProcedureOverview
@created_dossiers_count = dossiers @created_dossiers_count = dossiers
.where(created_at: start_date..Time.zone.now) .where(created_at: start_date..Time.zone.now)
.state_not_brouillon
.count .count
end end

View file

@ -34,6 +34,13 @@ describe ProcedureOverview, type: :model do
let!(:dossier_en_construction) do let!(:dossier_en_construction) do
create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_construction), created_at: monday) create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_construction), created_at: monday)
end end
let(:dossier_en_construction_deleted_by_user) do
create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_construction), created_at: monday)
end
before do
dossier_en_construction_deleted_by_user.update(hidden_by_user_at: Time.zone.now)
end
it { expect(procedure_overview.dossiers_en_construction_count).to eq(1) } it { expect(procedure_overview.dossiers_en_construction_count).to eq(1) }
end end