Merge pull request #4045 from tchak/fix-export-dossiers

Fix dates in dossiers export
This commit is contained in:
Paul Chavard 2019-07-09 10:52:20 +02:00 committed by GitHub
commit b7277b11ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -445,8 +445,8 @@ class Dossier < ApplicationRecord
['Archivé', :archived],
['État du dossier', I18n.t(state, scope: [:activerecord, :attributes, :dossier, :state])],
['Dernière mise à jour le', :updated_at],
['Passé en construction le', :en_instruction_at],
['Passé en instruction le', :en_construction_at],
['Passé en construction le', :en_construction_at],
['Passé en instruction le', :en_instruction_at],
['Traité le', :processed_at],
['Motivation de la décision', :motivation],
['Instructeurs', followers_gestionnaires.map(&:email).join(' ')]

View file

@ -80,6 +80,13 @@ describe ProcedureExportV2Service do
it 'should have data' do
expect(dossiers_sheet.data.size).to eq(1)
expect(etablissements_sheet.data.size).to eq(1)
# SimpleXlsxReader is transforming datetimes in utc... It is only used in test so we just hack around.
offset = dossier.en_construction_at.utc_offset
en_construction_at = Time.zone.at(dossiers_sheet.data[0][9] - offset.seconds)
en_instruction_at = Time.zone.at(dossiers_sheet.data[0][10] - offset.seconds)
expect(en_construction_at).to eq(dossier.en_construction_at.round)
expect(en_instruction_at).to eq(dossier.en_instruction_at.round)
end
end