Fix import bug.

This commit is contained in:
BoHung Chiu 2021-07-16 16:26:28 +08:00
parent dc9c36711d
commit d0bb7ee9e7
1 changed files with 5 additions and 1 deletions

View File

@ -33,7 +33,7 @@ module Admin::AnnouncementsHelper
value = {}
anns = Bulletin.new
row.cells.each_with_index do |cell,index|
val = cell.value rescue nil
val = cell.nil? ? nil : cell.value rescue nil
if [8,9,10,11,12,13,14,15].exclude?(index)
next if val.blank?
end
@ -65,24 +65,28 @@ module Admin::AnnouncementsHelper
anns.remote_image_url = val
when 8
value["en"] = val
anns.image_description_translations = value
when 9
value["zh_tw"] = val
anns.image_description_translations = value
value = {}
when 10
value["en"] = val
anns.title_translations = value
when 11
value["zh_tw"] = val
anns.title_translations = value
value = {}
when 12
value["en"] = val
anns.subtitle_translations = value
when 13
value["zh_tw"] = val
anns.subtitle_translations = value
value = {}
when 14
value["en"] = val
anns.text_translations = value
when 15
value["zh_tw"] = val
anns.text_translations = value