Skip to content

Commit

Permalink
refactor(suffix): be consistent with index suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSim committed May 7, 2024
1 parent 65e5a32 commit e3f3c6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions app/models/export_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@ def attachment_path(dossier, attachment, index, row_index)
end

def suffix(attachment, index, row_index)
suffix = ""
if index >= 1 && !row_index.nil?
suffix += "-#{index + 1}"
suffix += "-#{row_index + 1}" if row_index
end
suffix = "-#{index + 1}"
suffix += "-#{row_index + 1}" if row_index.present?

suffix + attachment.filename.extension_with_delimiter
end
Expand Down
2 changes: 1 addition & 1 deletion spec/services/procedure_export_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@
structure = [
"#{base_fn}/",
"#{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"
]
expect(files.size).to eq(structure.size)
Expand Down

0 comments on commit e3f3c6b

Please sign in to comment.