Skip to content

Commit

Permalink
[#10950] do not destroy cloned dossier
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagn committed Jan 24, 2025
1 parent 9d68496 commit 101b7d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def classer_sans_suite(motivation: nil, instructeur: nil, processed_at: Time.zon
end
end

scope :never_touched_brouillon_expired, -> { brouillon.where(last_champ_updated_at: nil, last_champ_piece_jointe_updated_at: nil).where(created_at: ..2.weeks.ago) }
scope :never_touched_brouillon_expired, -> { brouillon.where(last_champ_updated_at: nil, last_champ_piece_jointe_updated_at: nil, parent_dossier: nil).where(created_at: ..2.weeks.ago) }
scope :brouillon_expired, -> do
state_brouillon
.visible_by_user
Expand Down
5 changes: 3 additions & 2 deletions spec/models/dossier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2458,9 +2458,10 @@
it { is_expected.to contain_exactly(dossier) }

context 'when the dossier has been cloned' do
let!(:cloned_dossier) { travel_to(3.weeks.ago) { dossier_with_champ_updated.clone } }
let!(:cloned_dossier) { travel_to(3.weeks.ago) { dossier.clone } }
let!(:cloned_dossier_2) { travel_to(3.weeks.ago) { dossier_with_champ_updated.clone } }

it { is_expected.to contain_exactly(dossier, cloned_dossier) }
it { is_expected.to contain_exactly(dossier) }
end
end

Expand Down

0 comments on commit 101b7d7

Please sign in to comment.