lib/honor/model_additions.rb in honor-1.0.3 vs lib/honor/model_additions.rb in honor-2.0.0

- old
+ new

@@ -17,35 +17,35 @@ end end def points_today(category = nil) if category.nil? - points.where(:created_at => Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).sum(:value) else - points.where(:created_at => Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).where("points.category = ?", category).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).where("points.category = ?", category).sum(:value) end end def points_this_week(category = nil) if category.nil? - points.where(:created_at => Time.zone.now.beginning_of_week..Time.zone.now.end_of_week).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_week..Time.zone.now.end_of_week).sum(:value) else - points.where(:created_at => Time.zone.now.beginning_of_week..Time.zone.now.end_of_week).where("points.category = ?", category).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_week..Time.zone.now.end_of_week).where("points.category = ?", category).sum(:value) end end def points_this_month(category = nil) if category.nil? - points.where(:created_at => Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).sum(:value) else - points.where(:created_at => Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).where("points.category = ?", category).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).where("points.category = ?", category).sum(:value) end end def points_this_year(category = nil) if category.nil? - points.where(:created_at => Time.zone.now.beginning_of_year..Time.zone.now.end_of_year).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_year..Time.zone.now.end_of_year).sum(:value) else - points.where(:created_at => Time.zone.now.beginning_of_year..Time.zone.now.end_of_year).where("points.category = ?", category).sum(:value) + points.where(created_at: Time.zone.now.beginning_of_year..Time.zone.now.end_of_year).where("points.category = ?", category).sum(:value) end end -end \ No newline at end of file +end