diff --git a/app/jobs/fetch_time.rb b/app/jobs/fetch_time.rb deleted file mode 100644 index 5fce3036c..000000000 --- a/app/jobs/fetch_time.rb +++ /dev/null @@ -1,15 +0,0 @@ -# require 'open-uri' -# require 'nokogiri' -class FetchTime < Resque::Plugins::RestrictionJob - restrict :per_300 => 10 - - @queue = :low - - def self.perform() -# sleep 10 - doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241')) - CronMail.time_check(doc.at('#ct').children.first.text).deliver - puts "Mail Sent" - true - end -end diff --git a/app/jobs/update_tag_cloud.rb b/app/jobs/update_tag_cloud.rb new file mode 100644 index 000000000..e0df88d4b --- /dev/null +++ b/app/jobs/update_tag_cloud.rb @@ -0,0 +1,9 @@ +class UpdateTagCloud + @queue = :high + + def self.perform() + Tag.all.each do |tag| + tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now)) + end + end +end \ No newline at end of file diff --git a/app/models/tag.rb b/app/models/tag.rb index 758c7899d..29cc92aa4 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -12,6 +12,8 @@ class Tag field :key field :view_count, :type => Integer, :default => 0 + field :cloud_view_count, :type => Integer, :default => 0 + #field :cloud_amper,:type: Integer,:default=> 0 def self.sorted_for_cloud diff --git a/config/resque_schedule.yml b/config/resque_schedule.yml index 67d006ede..7c16fc240 100644 --- a/config/resque_schedule.yml +++ b/config/resque_schedule.yml @@ -16,8 +16,8 @@ nccu_daily_backup: args: description: Backup NCCU site -nccu_claender_sync: +update_tag_cloud: cron: 0 0 [0,12] * * * - class: NccuCalendar + class: UpdateTagCloud args: - description: Sync NCCU calendar RSS Feeds \ No newline at end of file + description: UpdateTagCloud \ No newline at end of file