Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: rkuykendall/Simplici7y
base: 800d6c7a2c
...
head fork: rkuykendall/Simplici7y
compare: b2d254d501
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 36 additions and 0 deletions.
  1. +36 −0 app/hourly.rb
  2. 0  script/runner
36 app/hourly.rb
View
@@ -0,0 +1,36 @@
+class Hourly < ActiveRecord::Base
+ # Code from example
+ # post_ids = Post.find(:all, :conditions => ["created_at < ?", 5.minutes.ago])
+ #
+ # if post_ids.size > 0
+ # Post.destroy(post_ids)
+ # puts "#{post_ids.size} posts have been deleted!"
+ # end
+
+ puts "Start!"
+
+ @items = Item.find(:all, :conditions => ["versions_count > 0"])
+
+ puts "Processing!"
+
+ @items.each do |item|
+ item.downloads_day_count = item.downloads.last_day.count
+ item.downloads_week_count = item.downloads.last_week.count
+ item.downloads_month_count = item.downloads.last_month.count
+ item.save
+ end
+
+ puts "Finished!"
+
+ # Code from downloads development
+ # after_filter :calculate_counts
+ #
+ # def calculate_counts
+ # item = Item.find_by_permalink(params[:item_id])
+ # item.downloads_day_count = item.downloads.last_day.count
+ # item.downloads_week_count = item.downloads.last_week.count
+ # item.downloads_month_count = item.downloads.last_month.count
+ # item.save
+ # end
+
+end
0  script/runner 100644 → 100755
View
File mode changed

No commit comments for this range

Something went wrong with that request. Please try again.