show last 30 days on about page

This commit is contained in:
Neil Lalonde 2015-02-02 12:27:49 -05:00
parent 8ba72b3a84
commit b56999e984
3 changed files with 13 additions and 3 deletions

View File

@ -37,31 +37,37 @@
<th>&nbsp;</th>
<th>{{i18n 'about.stat.all_time'}}</th>
<th>{{i18n 'about.stat.last_7_days'}}</th>
<th>{{i18n 'about.stat.last_30_days'}}</th>
</tr>
<tr>
<td class='title'>{{i18n 'about.topic_count'}}</td>
<td>{{number stats.topic_count}}</td>
<td>{{number stats.topics_7_days}}</td>
<td>{{number stats.topics_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.post_count'}}</td>
<td>{{number stats.post_count}}</td>
<td>{{number stats.posts_7_days}}</td>
<td>{{number stats.posts_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.user_count'}}</td>
<td>{{number stats.user_count}}</td>
<td>{{number stats.users_7_days}}</td>
<td>{{number stats.users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.active_user_count'}}</td>
<td></td>
<td>{{number stats.active_users_7_days}}</td>
<td>{{number stats.active_users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.like_count'}}</td>
<td>{{number stats.like_count}}</td>
<td>{{number stats.likes_7_days}}</td>
<td>{{number stats.likes_30_days}}</td>
</tr>
</table>
</section>

View File

@ -40,13 +40,16 @@ class About
post_count: Post.count,
user_count: User.count,
topics_7_days: Topic.listable_topics.where('created_at > ?', 7.days.ago).count,
topics_30_days: Topic.listable_topics.where('created_at > ?', 30.days.ago).count,
posts_7_days: Post.where('created_at > ?', 7.days.ago).count,
posts_30_days: Post.where('created_at > ?', 30.days.ago).count,
users_7_days: User.where('created_at > ?', 7.days.ago).count,
users_30_days: User.where('created_at > ?', 30.days.ago).count,
active_users_7_days: User.where('last_seen_at > ?', 7.days.ago).count,
active_users_30_days: User.where('last_seen_at > ?', 30.days.ago).count,
like_count: UserAction.where(action_type: UserAction::LIKE).count,
likes_7_days: UserAction.where(action_type: UserAction::LIKE)
.where("created_at > ?", 7.days.ago)
.count
likes_7_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 7.days.ago).count,
likes_30_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 30.days.ago).count
}
end

View File

@ -156,6 +156,7 @@ en:
stat:
all_time: "All Time"
last_7_days: "Last 7 Days"
last_30_days: "Last 30 Days"
like_count: "Likes"
topic_count: "Topics"
post_count: "Posts"