diff --git a/lib/remote_announcement.rb b/lib/remote_announcement.rb index 8864c2172..ad90b526f 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("test_site") +@db = Mongo::Connection.new("localhost", 27017).db("fgu_orbit") @coll_bulletin = @db["bulletins"] @coll_cat = @db["bulletin_categories"] @@ -25,6 +25,11 @@ def get_remote_bulletins_json(url) next if b[2]=="" next if @categories["#{b[7]}"].nil? + if b[5]=="" and b[4]!="" + b[5]=b[4] + b[4]="" + end + bulletin = { _type: "Bulletin", postdate: Time.parse(b[8]), created_at: Time.parse(b[8]), @@ -34,6 +39,7 @@ def get_remote_bulletins_json(url) is_rejected: false, bulletin_category_id: @categories["#{b[7]}"], title: {lang => b[2]}, + subtitle: {lang => b[4]}, text: {lang => b[5]}, available_for_zh_tw: true, available_for_en: true, @@ -66,6 +72,7 @@ def get_remote_bulletins_json(url) :is_rejected => this_bulletin["is_rejected"], :bulletin_category_id => bulletin[:bulletin_category_id], :title => bulletin[:title], + :subtitle => bulletin[:subtitle], :text => bulletin[:text], :available_for_zh_tw => this_bulletin["available_for_zh_tw"], :available_for_en => this_bulletin["available_for_en"],