diff --git a/vendor/built_in_modules/feed/lib/rss_dynamic.rb b/vendor/built_in_modules/feed/lib/rss_dynamic.rb index 51eda6e33..80f75a596 100644 --- a/vendor/built_in_modules/feed/lib/rss_dynamic.rb +++ b/vendor/built_in_modules/feed/lib/rss_dynamic.rb @@ -7,8 +7,8 @@ DB_NAME = "production_0" # Create a hash rss site list from mongodb db = Mongo::Connection.new("localhost", 27017).db("#{DB_NAME}") -SITES = Hash[ db["announcement_feeds"].find().entries.collect {|f| [ f["name"], f["link"] ]} ] -CATEGORIES = db["announcement_feeds"].find().entries.map {|f| f["category"] } +SITES = Hash[ db["announcement_feeds"].find().entries.collect {|f| [ f["name"], f["link"] ] } ] +CATEGORIES = Array(db["announcement_feeds"].find().entries.collect {|f| f["categories"] }) yesterday = Time.now - 86400 two_weeks_ago = Time.new - 60 * 60 * 24 * 14 @@ -24,7 +24,7 @@ SITES.each_with_index do |(name, url), i| feed.items.each do |item| category = item.category.to_s.gsub(/\<(\/)*category\>/, '') - if item.pubDate > yesterday && (CATEGORIES[i] == category || CATEGORIES[i] == "all") + if item.pubDate > yesterday && CATEGORIES[i].include?(category) recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '
').strip, link: item.link, category: category, source: name } end