Add resque job for NTU GA Announcemnet feed

This commit is contained in:
Bernie Chiu 2013-11-12 17:35:54 +08:00
parent 22b95d4b22
commit d10b647661
3 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,7 @@
class GetAnnouncementFromNtuGaRss
@queue = :high
def self.perform()
%x(ruby "#{Rails.root}/vendor/built_in_modules/announcement/lib/rss_ntu_ga_aggregate.rb")
end
end

View File

@ -33,3 +33,9 @@ get_announcement_from_rss:
class: GetAnnouncementFromRss class: GetAnnouncementFromRss
args: args:
description: Loop through the announcement RSS until 24h ago description: Loop through the announcement RSS until 24h ago
get_announcement_from_ntu_ga_rss:
cron: 0 0 [2,12] * * *
class: GetAnnouncementFromNtuGaRss
args:
description: Update announcement RSS to primary NTU_GA site

View File

@ -30,7 +30,7 @@ SITES.each do |name, url|
feed.items.each do |item| feed.items.each do |item|
category = item.category.to_s.gsub(/\<(\/)*category\>/, '') category = item.category.to_s.gsub(/\<(\/)*category\>/, '')
if item.pubDate > two_weeks_ago if item.pubDate > yesterday
recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '<br/>').strip, recent_feed[item.title.strip] = { date: item.pubDate, description: item.description.gsub("\r\n", '<br/>').strip,
link: item.link, category: category } link: item.link, category: category }
end end