Dossier: rename data_with_champs to to_sorted_values
This commit is contained in:
parent
f0373f6bc2
commit
3f2419a2a3
2 changed files with 10 additions and 10 deletions
|
@ -232,7 +232,7 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_data_strings_array
|
def full_data_strings_array
|
||||||
data_with_champs.map do |value|
|
to_sorted_values.map do |value|
|
||||||
serialize_value_for_export(value)
|
serialize_value_for_export(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -248,13 +248,13 @@ class Dossier < ActiveRecord::Base
|
||||||
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_with_champs
|
def to_sorted_values
|
||||||
serialized_dossier = DossierTableExportSerializer.new(self)
|
serialized_dossier = DossierTableExportSerializer.new(self)
|
||||||
data = serialized_dossier.attributes.values
|
values = serialized_dossier.attributes.values
|
||||||
data += self.ordered_champs.map(&:value)
|
values += self.ordered_champs.map(&:value)
|
||||||
data += self.ordered_champs_private.map(&:value)
|
values += self.ordered_champs_private.map(&:value)
|
||||||
data += self.export_entreprise_data.values
|
values += self.export_entreprise_data.values
|
||||||
data
|
values
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_headers
|
def export_headers
|
||||||
|
|
|
@ -412,8 +412,8 @@ describe Dossier do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#data_with_champs' do
|
describe '#to_sorted_values' do
|
||||||
subject { dossier.data_with_champs }
|
subject { dossier.to_sorted_values }
|
||||||
|
|
||||||
it { expect(subject[0]).to be_a_kind_of(Integer) }
|
it { expect(subject[0]).to be_a_kind_of(Integer) }
|
||||||
it { expect(subject[1]).to be_a_kind_of(Time) }
|
it { expect(subject[1]).to be_a_kind_of(Time) }
|
||||||
|
@ -441,7 +441,7 @@ describe Dossier do
|
||||||
context 'dossier for individual' do
|
context 'dossier for individual' do
|
||||||
let(:dossier_with_individual) { create(:dossier, :for_individual, user: user, procedure: procedure) }
|
let(:dossier_with_individual) { create(:dossier, :for_individual, user: user, procedure: procedure) }
|
||||||
|
|
||||||
subject { dossier_with_individual.data_with_champs }
|
subject { dossier_with_individual.to_sorted_values }
|
||||||
|
|
||||||
it { expect(subject[12]).to eq(dossier_with_individual.individual.gender) }
|
it { expect(subject[12]).to eq(dossier_with_individual.individual.gender) }
|
||||||
it { expect(subject[13]).to eq(dossier_with_individual.individual.prenom) }
|
it { expect(subject[13]).to eq(dossier_with_individual.individual.prenom) }
|
||||||
|
|
Loading…
Reference in a new issue