Fix bugs for FGU remote_annoucement
Handle exception when category is missing
This commit is contained in:
parent
f851ad0e27
commit
f715924929
|
@ -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]),
|
||||
|
|
Loading…
Reference in New Issue