From 6ee333cba716d69801505d3963862e3fc9a96150 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 22 Apr 2009 13:41:17 +0000 Subject: [PATCH] Use postgres interval syntax. --- script/statistics | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/script/statistics b/script/statistics index 7105d475d..5a17e8be4 100755 --- a/script/statistics +++ b/script/statistics @@ -45,23 +45,23 @@ begin puts "Data TypeDayWeekMonth" day_count = Trace.count(:user_id, :distinct => true, - :conditions => "timestamp > NOW() - INTERVAL 1 DAY") + :conditions => "timestamp > NOW() - '1 DAY'::INTERVAL") week_count = Trace.count(:user_id, :distinct => true, - :conditions => "timestamp > NOW() - INTERVAL 7 DAY") + :conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL") month_count = Trace.count(:user_id, :distinct => true, - :conditions => "timestamp > NOW() - INTERVAL 28 DAY") + :conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL") puts "GPX Files#{day_count}#{week_count}#{month_count}" day_count = OldNode.count(:user_id, :distinct => true, :include => :changeset, - :conditions => "timestamp > NOW() - INTERVAL 1 DAY") + :conditions => "timestamp > NOW() - '1 DAY'::INTERVAL") week_count = OldNode.count(:user_id, :distinct => true, :include => :changeset, - :conditions => "timestamp > NOW() - INTERVAL 7 DAY") + :conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL") month_count = OldNode.count(:user_id, :distinct => true, :include => :changeset, - :conditions => "timestamp > NOW() - INTERVAL 28 DAY") + :conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL") puts "Nodes#{day_count}#{week_count}#{month_count}" @@ -71,13 +71,13 @@ begin puts "" puts "" - day_users = OldNode.count(:conditions => "timestamp > NOW() - INTERVAL 1 DAY", + day_users = OldNode.count(:conditions => "timestamp > NOW() - '1 DAY'::INTERVAL", :include => :changeset, :group => :user_id, :order => "count_all DESC") - week_users = OldNode.count(:conditions => "timestamp > NOW() - INTERVAL 7 DAY", + week_users = OldNode.count(:conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL", :include => :changeset, :group => :user_id, :order => "count_all DESC", :limit => 60) - month_users = OldNode.count(:conditions => "timestamp > NOW() - INTERVAL 28 DAY", + month_users = OldNode.count(:conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL", :include => :changeset, :group => :user_id, :order => "count_all DESC", :limit => 60) -- 2.43.2
DayWeekMonth