fix(dossier): projected champs should have updated_at

This commit is contained in:
Paul Chavard 2024-10-05 22:22:04 +02:00
parent 5cbdfd8677
commit 274e43c5e6
No known key found for this signature in database
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) check_valid_row_id?(type_de_champ, row_id)
champ = champs_by_public_id[type_de_champ.public_id(row_id)] champ = champs_by_public_id[type_de_champ.public_id(row_id)]
if champ.nil? 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 else
champ champ
end end

View file

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