update dossiers count when passing to construction

This commit is contained in:
Christophe Robillard 2023-01-06 17:48:00 +01:00
parent bd92291f8a
commit c5acd82e6e
2 changed files with 10 additions and 0 deletions

View file

@ -874,6 +874,7 @@ class Dossier < ApplicationRecord
.passer_en_construction
.processed_at
save!
procedure.compute_dossiers_count
end
def after_passer_en_instruction(h)

View file

@ -2080,6 +2080,15 @@ describe Dossier do
end
end
describe 'update procedure dossiers count' do
let(:dossier) { create(:dossier, :brouillon, :with_individual) }
it 'update procedure dossiers count when passing to construction' do
expect(dossier.procedure).to receive(:compute_dossiers_count)
dossier.passer_en_construction!
end
end
private
def count_for_month(processed_by_month, month)