From 0b7cf3ae75a2cfd8d6b97f44680c9ad4e720b4e4 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 26 Apr 2018 18:25:59 +0200 Subject: [PATCH] `#full_data_strings_array` -> `#export_values` --- app/models/dossier.rb | 12 ++++++------ app/models/procedure.rb | 2 +- spec/models/dossier_spec.rb | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index b0459788a..449641cb5 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -138,12 +138,6 @@ class Dossier < ApplicationRecord end end - def full_data_strings_array - to_sorted_values.map do |value| - serialize_value_for_export(value) - end - end - def export_etablissement_data if etablissement.present? etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.transform_keys { |k| "etablissement.#{k}".parameterize.underscore.to_sym } @@ -173,6 +167,12 @@ class Dossier < ApplicationRecord headers end + def export_values + to_sorted_values.map do |value| + serialize_value_for_export(value) + end + end + def followers_gestionnaires follows.includes(:gestionnaire).map(&:gestionnaire) end diff --git a/app/models/procedure.rb b/app/models/procedure.rb index e0cc03d12..b9ee0dfa4 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -190,7 +190,7 @@ class Procedure < ApplicationRecord exportable_dossiers = dossiers.downloadable_sorted headers = exportable_dossiers&.first&.export_headers || [] - data = exportable_dossiers.any? ? exportable_dossiers.map { |d| d.full_data_strings_array } : [[]] + data = exportable_dossiers.any? ? exportable_dossiers.map(&:export_values) : [[]] { headers: headers, diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 9152e3153..c60841f22 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -319,7 +319,7 @@ describe Dossier do subject { dossier } - it { expect(dossier.full_data_strings_array).to eq(expected_string) } + it { expect(dossier.export_values).to eq(expected_string) } end end