Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, 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
View
36 app/hourly.rb
@@ -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
View
0  script/runner 100644 → 100755
File mode changed

No commit comments for this range

Something went wrong with that request. Please try again.