Merge pull request #8748 from colinux/fix-clone-estimated-dossier

Administrateur: le clone d'une démarche ne copie pas le cache du nombre de dossiers
This commit is contained in:
Colin Darie 2023-03-09 15:25:08 +00:00 committed by GitHub
commit 6243e5fb92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -521,6 +521,7 @@ class Procedure < ApplicationRecord
procedure.duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION procedure.duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION
procedure.max_duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION procedure.max_duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION
end end
procedure.estimated_dossiers_count = 0
procedure.published_revision = nil procedure.published_revision = nil
procedure.draft_revision.procedure = procedure procedure.draft_revision.procedure = procedure

View file

@ -486,7 +486,8 @@ describe Procedure do
types_de_champ_public: [{}, {}, { type: :drop_down_list }, { type: :piece_justificative }, { type: :repetition, children: [{}] }], types_de_champ_public: [{}, {}, { type: :drop_down_list }, { type: :piece_justificative }, { type: :repetition, children: [{}] }],
types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }], types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }],
api_particulier_token: '123456789012345', api_particulier_token: '123456789012345',
api_particulier_scopes: ['cnaf_famille']) api_particulier_scopes: ['cnaf_famille'],
estimated_dossiers_count: 4)
end end
let(:type_de_champ_repetition) { procedure.draft_revision.types_de_champ_public.last } let(:type_de_champ_repetition) { procedure.draft_revision.types_de_champ_public.last }
let(:type_de_champ_private_repetition) { procedure.draft_revision.types_de_champ_private.last } let(:type_de_champ_private_repetition) { procedure.draft_revision.types_de_champ_private.last }
@ -565,7 +566,10 @@ describe Procedure do
cloned_procedure = subject cloned_procedure = subject
cloned_procedure.parent_procedure_id = nil cloned_procedure.parent_procedure_id = nil
expect(cloned_procedure).to have_same_attributes_as(procedure, except: ["path", "draft_revision_id", "service_id", "duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds", 'max_duree_conservation_dossiers_dans_ds']) expect(cloned_procedure).to have_same_attributes_as(procedure, except: [
"path", "draft_revision_id", "service_id", 'estimated_dossiers_count',
"duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds", 'max_duree_conservation_dossiers_dans_ds'
])
end end
context 'which is opendata' do context 'which is opendata' do
@ -672,6 +676,10 @@ describe Procedure do
expect(subject.dossiers).to eq([]) expect(subject.dossiers).to eq([])
end end
it "should reset estimated_dossiers_count" do
expect(subject.estimated_dossiers_count).to eq(0)
end
describe 'should not duplicate lien_notice' do describe 'should not duplicate lien_notice' do
let(:procedure) { create(:procedure, lien_notice: "http://toto.com") } let(:procedure) { create(:procedure, lien_notice: "http://toto.com") }