From 56ed901703bc9dfa0cc2bbd20c75f41b14d9f12b Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 7 Feb 2024 17:30:20 +0100 Subject: [PATCH] tech(clean): remove dead code --- app/models/dossier.rb | 11 ----------- spec/models/dossier_spec.rb | 5 ----- 2 files changed, 16 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 2e75d9319..697f51e68 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -740,17 +740,6 @@ class Dossier < ApplicationRecord procedure.duree_conservation_dossiers_dans_ds + (conservation_extension / 1.month.to_i) end - def avis_for_instructeur(instructeur) - if instructeur.dossiers.include?(self) - avis.order(created_at: :asc) - else - avis - .where(confidentiel: false) - .or(avis.where(claimant: instructeur)) - .order(created_at: :asc) - end - end - def avis_for_expert(expert) Avis .where(dossier_id: id, confidentiel: false) diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 37e76080c..ba20ceb63 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -410,7 +410,6 @@ describe Dossier, type: :model do context 'when there is a public advice asked from the dossiers instructeur' do let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, confidentiel: false) } - it { expect(dossier.avis_for_instructeur(instructeur)).to match([avis]) } it { expect(dossier.avis_for_expert(expert_1)).to match([avis]) } it { expect(dossier.avis_for_expert(expert_2)).to match([avis]) } end @@ -418,7 +417,6 @@ describe Dossier, type: :model do context 'when there is a private advice asked from the dossiers instructeur' do let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, confidentiel: true) } - it { expect(dossier.avis_for_instructeur(instructeur)).to match([avis]) } it { expect(dossier.avis_for_expert(expert_1)).to match([avis]) } it { expect(dossier.avis_for_expert(expert_2)).not_to match([avis]) } end @@ -427,7 +425,6 @@ describe Dossier, type: :model do let!(:avis_1) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, confidentiel: false) } let!(:avis_2) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure_2, confidentiel: false) } - it { expect(dossier.avis_for_instructeur(instructeur)).to match([avis_1, avis_2]) } it { expect(dossier.avis_for_expert(expert_1)).to match([avis_1, avis_2]) } it { expect(dossier.avis_for_expert(expert_2)).to match([avis_1, avis_2]) } end @@ -436,7 +433,6 @@ describe Dossier, type: :model do let!(:avis_1) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, confidentiel: true) } let!(:avis_2) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure_2, confidentiel: true) } - it { expect(dossier.avis_for_instructeur(instructeur)).to match([avis_1, avis_2]) } it { expect(dossier.avis_for_expert(expert_1)).to match([avis_1]) } it { expect(dossier.avis_for_expert(expert_2)).to match([avis_2]) } end @@ -446,7 +442,6 @@ describe Dossier, type: :model do let!(:avis_2) { create(:avis, dossier: dossier, claimant: expert_1, experts_procedure: experts_procedure_2, confidentiel: false, created_at: Time.zone.parse('9/01/2010')) } let!(:avis_3) { create(:avis, dossier: dossier, claimant: expert_1, experts_procedure: experts_procedure_2, confidentiel: false, created_at: Time.zone.parse('11/01/2010')) } - it { expect(dossier.avis_for_instructeur(instructeur)).to match([avis_2, avis_1, avis_3]) } it { expect(dossier.avis_for_expert(expert_1)).to match([avis_2, avis_1, avis_3]) } end