Skip to content

Commit

Permalink
Trying to fix an issue with PostgreSQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristandunn committed Oct 12, 2009
1 parent 986781a commit bcab847
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sparkline.rb
Expand Up @@ -5,7 +5,7 @@ def self.included(model)

module ClassMethods
def counts_grouped_by_created_at_from_past(days)
all :select => 'COUNT(id) AS count, created_at',
all :select => 'COUNT(id) AS count, DATE(created_at) AS created_at',
:group => 'DATE(created_at)',
:order => 'created_at DESC',
:limit => days / 1.day
Expand All @@ -18,7 +18,7 @@ def sparkline_data_from_past(days)
(0..(days - 1)).inject([]) do |result, day|
date = day.days.ago.to_date
record = records.find { |record|
record.created_at && record.created_at.to_date == date
record.created_at && record.created_at == date
}

result << record.try(:count).to_i
Expand Down

0 comments on commit bcab847

Please sign in to comment.