commit
61ff2f4c36
3 changed files with 9 additions and 5 deletions
|
@ -8,7 +8,7 @@
|
|||
# updated_at :datetime not null
|
||||
#
|
||||
class Export < ApplicationRecord
|
||||
MAX_DUREE_CONSERVATION_EXPORT = 15.minutes
|
||||
MAX_DUREE_CONSERVATION_EXPORT = 1.hour
|
||||
|
||||
enum format: {
|
||||
csv: 'csv',
|
||||
|
@ -24,7 +24,7 @@ class Export < ApplicationRecord
|
|||
|
||||
scope :stale, -> { where('updated_at < ?', (Time.zone.now - MAX_DUREE_CONSERVATION_EXPORT)) }
|
||||
|
||||
after_save_commit :compute_async
|
||||
after_create_commit :compute_async
|
||||
|
||||
def compute_async
|
||||
ExportJob.perform_later(self)
|
||||
|
|
|
@ -73,7 +73,11 @@ class ProcedureExportService
|
|||
{ instances: table.last, sheet_name: table.first }
|
||||
end.merge(DEFAULT_STYLES)
|
||||
|
||||
options[:sheet_name] = options[:sheet_name].truncate(30)
|
||||
# transliterate: convert to ASCII characteres
|
||||
# to ensure truncate respects 30 bytes
|
||||
options[:sheet_name] = I18n.transliterate(options[:sheet_name], '')
|
||||
.truncate(30, omission: '')
|
||||
|
||||
options
|
||||
end
|
||||
end
|
||||
|
|
|
@ -356,10 +356,10 @@ describe ProcedureExportService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with long libelle' do
|
||||
context 'with long libelle composed of utf8 characteres' do
|
||||
before do
|
||||
procedure.types_de_champ.each do |c|
|
||||
c.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.")
|
||||
c.update!(libelle: "#{c.id} - éééé ééé ééé ééééééé ééééééé ééééééé éééééééé. ééé éé éééééééé éé ééé. ééééé éééééééé ééé ééé.")
|
||||
end
|
||||
champ_repetition.champs.each do |c|
|
||||
c.type_de_champ.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.")
|
||||
|
|
Loading…
Reference in a new issue