Add email counts to admin dashboard

This commit is contained in:
Neil Lalonde
2013-03-17 15:08:38 -04:00
parent 6a99d12784
commit 50b04b2209
8 changed files with 36 additions and 3 deletions

View File

@ -7,4 +7,8 @@ class EmailLog < ActiveRecord::Base
# Update last_emailed_at if the user_id is present
User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present?
end
def self.count_per_day(since = 30.days.ago)
where('created_at > ?', since).group('date(created_at)').order('date(created_at)').count
end
end