2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FEATURE: Admin dashboard data for user profile views.

This commit is contained in:
Guo Xiang Tan 2015-09-15 01:30:06 +08:00
parent 7acc93b2a0
commit 21725cc907
4 changed files with 18 additions and 0 deletions

View file

@ -39,4 +39,9 @@ class UserProfileView < ActiveRecord::Base
end
end
end
def self.profile_views_by_day(start_date, end_date)
profile_views = self.where("viewed_at >= ? AND viewed_at < ?", start_date, end_date + 1.day)
profile_views.group("date(viewed_at)").order("date(viewed_at)").count
end
end