diff --git a/app/models/exported_column.rb b/app/models/exported_column.rb index 83bf11a39c8..651407a71d4 100644 --- a/app/models/exported_column.rb +++ b/app/models/exported_column.rb @@ -11,8 +11,7 @@ def initialize(column:, libelle:) def id = { id: column.id, libelle: }.to_json def libelle_with_value(champ_or_dossier, format:) - raw_value = champ_or_dossier.present? ? @column.value(champ_or_dossier) : nil - [libelle, ExportedColumnFormatter.format(column:, raw_value:, format:), spreadsheet_architect_type] + [libelle, ExportedColumnFormatter.format(column:, champ_or_dossier:, format:), spreadsheet_architect_type] end def spreadsheet_architect_type diff --git a/app/services/exported_column_formatter.rb b/app/services/exported_column_formatter.rb index db0b6092257..824b26d295f 100644 --- a/app/services/exported_column_formatter.rb +++ b/app/services/exported_column_formatter.rb @@ -1,8 +1,10 @@ # frozen_string_literal: true class ExportedColumnFormatter - def self.format(column:, raw_value:, format:) - return if raw_value.nil? + def self.format(column:, champ_or_dossier:, format:) + return if champ_or_dossier.nil? + + raw_value = column.value(champ_or_dossier) case column.type when :boolean @@ -13,8 +15,6 @@ def self.format(column:, raw_value:, format:) format_enum(column:, raw_value:) when :enums format_enums(column:, raw_values: raw_value) - when :datetime, :date - I18n.l(raw_value) else raw_value end