From b974cb771a84d107702b1533a8eda639d2ba2f01 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 29 Jun 2016 18:37:03 +0800 Subject: [PATCH] fix for xls import for blank url and files descriptions --- app/helpers/admin/announcements_helper.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/helpers/admin/announcements_helper.rb b/app/helpers/admin/announcements_helper.rb index 501697d..e0feaaa 100644 --- a/app/helpers/admin/announcements_helper.rb +++ b/app/helpers/admin/announcements_helper.rb @@ -87,9 +87,9 @@ module Admin::AnnouncementsHelper anns.text_translations = value value = {} when 16 - links = val.split(";") - desc_en = row.cells[17].value.split(";") - desc_zh_tw = row.cells[18].value.split(";") + links = val.split(";") rescue [] + desc_en = row.cells[17].value.split(";") rescue [] + desc_zh_tw = row.cells[18].value.split(";") rescue [] links.each_with_index do |link,i| bl = BulletinLink.new bl.url = link.strip @@ -98,11 +98,11 @@ module Admin::AnnouncementsHelper bl.save end when 19 - files = val.split(";") - desc_en = row.cells[20].value.split(";") - desc_zh_tw = row.cells[21].value.split(";") - alt_en = row.cells[22].value.split(";") - alt_zh_tw = row.cells[23].value.split(";") + files = val.split(";") rescue [] + desc_en = row.cells[20].value.split(";") rescue [] + desc_zh_tw = row.cells[21].value.split(";") rescue [] + alt_en = row.cells[22].value.split(";") rescue [] + alt_zh_tw = row.cells[23].value.split(";") rescue [] files.each_with_index do |file, i| bf = BulletinFile.new bf.remote_file_url = file.strip rescue nil