Permalink
Browse files

fix stats query

  • Loading branch information...
bborn committed Apr 6, 2011
1 parent 2d476c0 commit bb69420fe4e8242654174271631a78441137c2c6
Showing with 4 additions and 5 deletions.
  1. +4 −5 app/controllers/users_controller.rb
@@ -399,14 +399,13 @@ def statistics
date = Date.new(params[:date][:year].to_i, params[:date][:month].to_i)
@month = Time.parse(date.to_s)
else
- @month = Date.today
+ @month = Date.today
end
- start_date = @month.beginning_of_month
- end_date = @month.end_of_month + 1.day
+ start_date = @month.utc.beginning_of_month.beginning_of_day
+ end_date = @month.utc.end_of_month.end_of_day
- @posts = @user.posts.find(:all,
- :conditions => ['? <= published_at AND published_at <= ?', start_date, end_date])
+ @posts = @user.posts.find(:all, :conditions => ['? <= published_at AND published_at <= ?', start_date, end_date])
@estimated_payment = @posts.sum do |p|
7

0 comments on commit bb69420

Please sign in to comment.