refactor(suffix): be consistent with index suffix
This commit is contained in:
parent
b656867836
commit
585810553f
2 changed files with 3 additions and 6 deletions
|
@ -148,11 +148,8 @@ class ExportTemplate < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def suffix(attachment, index, row_index)
|
def suffix(attachment, index, row_index)
|
||||||
suffix = ""
|
suffix = "-#{index + 1}"
|
||||||
if index >= 1 && !row_index.nil?
|
suffix += "-#{row_index + 1}" if row_index.present?
|
||||||
suffix += "-#{index + 1}"
|
|
||||||
suffix += "-#{row_index + 1}" if row_index
|
|
||||||
end
|
|
||||||
|
|
||||||
suffix + attachment.filename.extension_with_delimiter
|
suffix + attachment.filename.extension_with_delimiter
|
||||||
end
|
end
|
||||||
|
|
|
@ -544,7 +544,7 @@ describe ProcedureExportService do
|
||||||
structure = [
|
structure = [
|
||||||
"#{base_fn}/",
|
"#{base_fn}/",
|
||||||
"#{base_fn}/dossier-#{dossier.id}/",
|
"#{base_fn}/dossier-#{dossier.id}/",
|
||||||
"#{base_fn}/dossier-#{dossier.id}/piece_justificative-#{dossier.id}.txt",
|
"#{base_fn}/dossier-#{dossier.id}/piece_justificative-#{dossier.id}-1.txt",
|
||||||
"#{base_fn}/dossier-#{dossier.id}/export_#{dossier.id}.pdf"
|
"#{base_fn}/dossier-#{dossier.id}/export_#{dossier.id}.pdf"
|
||||||
]
|
]
|
||||||
expect(files.size).to eq(structure.size)
|
expect(files.size).to eq(structure.size)
|
||||||
|
|
Loading…
Reference in a new issue