Merge pull request #10894 from tchak/fix-projected-champs-with-updated-at

fix(dossier): projected champs should have updated_at
This commit is contained in:
Paul Chavard 2024-10-07 08:21:20 +00:00 committed by GitHub
commit 73eed5d2a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -25,7 +25,7 @@ module DossierChampsConcern
check_valid_row_id?(type_de_champ, row_id)
champ = champs_by_public_id[type_de_champ.public_id(row_id)]
if champ.nil?
type_de_champ.build_champ(dossier: self, row_id:)
type_de_champ.build_champ(dossier: self, row_id:, updated_at: depose_at || created_at)
else
champ
end

View file

@ -66,6 +66,7 @@ RSpec.describe DossierChampsConcern do
it {
expect(subject.new_record?).to be_truthy
expect(subject.is_a?(Champs::TextChamp)).to be_truthy
expect(subject.updated_at).not_to be_nil
}
context "in repetition" do
@ -76,6 +77,7 @@ RSpec.describe DossierChampsConcern do
expect(subject.new_record?).to be_truthy
expect(subject.is_a?(Champs::TextChamp)).to be_truthy
expect(subject.row_id).to eq(row_id)
expect(subject.updated_at).not_to be_nil
}
context "invalid row_id" do
@ -99,6 +101,7 @@ RSpec.describe DossierChampsConcern do
it {
expect(subject.new_record?).to be_truthy
expect(subject.is_a?(Champs::TextChamp)).to be_truthy
expect(subject.updated_at).not_to be_nil
}
end
end