fix error

This commit is contained in:
邱博亞 2021-03-30 15:45:22 +08:00
parent c40c552a1d
commit c1a5e89d57
2 changed files with 5 additions and 6 deletions

View File

@ -381,8 +381,8 @@ class Admin::GalleriesController < OrbitAdminController
if sheet.count <= 203
sheet.each_with_index do |row, i|
next if i < 3
v = row.cells.first.value
next if v == "" || v.nil?
v = row.cells.first.value rescue nil
next if v.blank?
import_this_image(row, album)
end
redirect_to admin_gallery_path(album.id)

View File

@ -3,15 +3,14 @@ module Admin::GalleriesHelper
value = {}
image = AlbumImage.new
row.cells.each_with_index do |cell,index|
next if cell.nil?
val = cell.value
next if val.nil? || val == ""
val = cell.value rescue nil
next if val.blank?
case index
when 0
image.remote_file_url = val
when 1
value["zh_tw"] = val
value["en"] = row.cells[index + 1].value rescue ""
value["en"] = (row.cells[index + 1].value rescue "")
image.description_translations = value
end
end