From f7159249296aaa93b46529c0db1a2a413f05d69d Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Wed, 2 Oct 2013 10:25:27 +0800 Subject: [PATCH] Fix bugs for FGU remote_annoucement Handle exception when category is missing --- lib/remote_announcement.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/remote_announcement.rb b/lib/remote_announcement.rb index 141dab58d..8864c2172 100644 --- a/lib/remote_announcement.rb +++ b/lib/remote_announcement.rb @@ -3,7 +3,7 @@ require 'open-uri' require 'json' require 'date' -@db = Mongo::Connection.new("localhost", 27017).db("fgu_orbit") +@db = Mongo::Connection.new("localhost", 27017).db("test_site") @coll_bulletin = @db["bulletins"] @coll_cat = @db["bulletin_categories"] @@ -23,6 +23,7 @@ def get_remote_bulletins_json(url) lang = b[1]=='zh-tw' ? "zh_tw".to_sym : "en".to_sym next if b[2]=="" + next if @categories["#{b[7]}"].nil? bulletin = { _type: "Bulletin", postdate: Time.parse(b[8]),