From d0bb7ee9e70ec9e43a88c143d64a7d7b77e14475 Mon Sep 17 00:00:00 2001 From: Bohung Date: Fri, 16 Jul 2021 16:26:28 +0800 Subject: [PATCH] Fix import bug. --- app/helpers/admin/announcements_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/admin/announcements_helper.rb b/app/helpers/admin/announcements_helper.rb index bba3288..b6b90f1 100644 --- a/app/helpers/admin/announcements_helper.rb +++ b/app/helpers/admin/announcements_helper.rb @@ -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