fix error

This commit is contained in:
邱博亞 2021-03-30 15:27:20 +08:00
parent 7d12d71f14
commit 35d8843705
2 changed files with 6 additions and 5 deletions

View File

@ -130,8 +130,8 @@ class Admin::AnnouncementsController < OrbitAdminController
if sheet.count <= 503
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_announcement(row, categories, tags)
end
redirect_to admin_announcements_path

View File

@ -33,9 +33,10 @@ module Admin::AnnouncementsHelper
value = {}
anns = Bulletin.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
if [8,9,10,11,12,13,14,15].exclude?(index)
next if val.blank?
end
case index
when 0
anns.category = categories[val.to_i]