Fix import items to inventory (#2019)

This commit is contained in:
aignatov-bio 2019-09-05 08:35:11 +02:00 committed by GitHub
parent 59a85d8181
commit bc86d5bc40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,15 @@
# frozen_string_literal: true
class SpreadsheetParser
# Based on file's extension opens file (used for importing)
def self.open_spreadsheet(file)
filename = file.original_filename
file_path = file.path
if file.class == ActionDispatch::Http::UploadedFile
filename = file.original_filename
file_path = file.path
else
filename = file.filename.to_s
file_path = file.service_url
end
case File.extname(filename)
when '.csv'