Show total likes given. Put likes given/received and flags given/received together.

This commit is contained in:
Neil Lalonde 2014-08-22 15:23:10 -04:00
parent 79f7a922ef
commit 00c28f2391
4 changed files with 8 additions and 16 deletions

View File

@ -320,8 +320,7 @@
</div> </div>
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.user.like_count}}</div> <div class='field'>{{i18n admin.user.like_count}}</div>
<div class='value'>{{like_count}}</div> <div class='value'>{{like_given_count}} / {{like_count}}</div>
<div class='controls'>{{like_count_last_100_days}} {{i18n admin.user.last_100_days}}</div>
</div> </div>
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.user.topics_entered}}</div> <div class='field'>{{i18n admin.user.topics_entered}}</div>
@ -346,12 +345,8 @@
<div class='value'>{{posts_read_count}}</div> <div class='value'>{{posts_read_count}}</div>
</div> </div>
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.user.flags_given_count}}</div> <div class='field'>{{i18n admin.user.flags_given_received_count}}</div>
<div class='value'>{{flags_given_count}}</div> <div class='value'>{{flags_given_count}} / {{flags_received_count}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n admin.user.flags_received_count}}</div>
<div class='value'>{{flags_received_count}}</div>
</div> </div>
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.user.private_topics_count}}</div> <div class='field'>{{i18n admin.user.private_topics_count}}</div>

View File

@ -375,8 +375,8 @@ class User < ActiveRecord::Base
UserAction.where(user_id: id, action_type: UserAction::WAS_LIKED).count UserAction.where(user_id: id, action_type: UserAction::WAS_LIKED).count
end end
def like_count_since(time) def like_given_count
UserAction.where(user_id: id, action_type: UserAction::WAS_LIKED).where('created_at > ?', time).count UserAction.where(user_id: id, action_type: UserAction::LIKE).count
end end
def post_count def post_count

View File

@ -7,7 +7,7 @@ class AdminDetailedUserSerializer < AdminUserSerializer
:can_revoke_moderation, :can_revoke_moderation,
:can_impersonate, :can_impersonate,
:like_count, :like_count,
:like_count_last_100_days, :like_given_count,
:post_count, :post_count,
:topic_count, :topic_count,
:flags_given_count, :flags_given_count,
@ -53,10 +53,6 @@ class AdminDetailedUserSerializer < AdminUserSerializer
object.moderator object.moderator
end end
def like_count_last_100_days
object.like_count_since(100.days.ago)
end
def topic_count def topic_count
object.topics.count object.topics.count
end end

View File

@ -1879,7 +1879,7 @@ en:
reputation: Reputation reputation: Reputation
permissions: Permissions permissions: Permissions
activity: Activity activity: Activity
like_count: Likes Received like_count: Likes Given / Received
last_100_days: 'in the last 100 days' last_100_days: 'in the last 100 days'
private_topics_count: Private Topics private_topics_count: Private Topics
posts_read_count: Posts Read posts_read_count: Posts Read
@ -1887,6 +1887,7 @@ en:
topics_entered: Topics Viewed topics_entered: Topics Viewed
flags_given_count: Flags Given flags_given_count: Flags Given
flags_received_count: Flags Received flags_received_count: Flags Received
flags_given_received_count: 'Flags Given / Received'
approve: 'Approve' approve: 'Approve'
approved_by: "approved by" approved_by: "approved by"
approve_success: "User approved and email sent with activation instructions." approve_success: "User approved and email sent with activation instructions."