add feedback count for #1323
This commit is contained in:
@@ -519,7 +519,7 @@ class User < ActiveRecord::Base
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
options[:methods] ||= []
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count]
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count, :positive_feedback_count, :neutral_feedback_count, :negative_feedback_count]
|
||||
super(options)
|
||||
end
|
||||
|
||||
@@ -529,7 +529,7 @@ class User < ActiveRecord::Base
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
options[:methods] ||= []
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count]
|
||||
options[:methods] += [:wiki_page_version_count, :artist_version_count, :pool_version_count, :forum_post_count, :comment_count, :positive_feedback_count, :neutral_feedback_count, :negative_feedback_count]
|
||||
super(options, &block)
|
||||
end
|
||||
|
||||
@@ -563,6 +563,18 @@ class User < ActiveRecord::Base
|
||||
def comment_count
|
||||
Comment.for_creator(id).count
|
||||
end
|
||||
|
||||
def positive_feedback_count
|
||||
feedback.positive.count
|
||||
end
|
||||
|
||||
def neutral_feedback_count
|
||||
feedback.neutral.count
|
||||
end
|
||||
|
||||
def negative_feedback_count
|
||||
feedback.negative.count
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
|
||||
@@ -128,9 +128,9 @@ class UserPresenter
|
||||
end
|
||||
|
||||
def feedbacks(template)
|
||||
positive = UserFeedback.for_user(user.id).positive.count
|
||||
neutral = UserFeedback.for_user(user.id).neutral.count
|
||||
negative = UserFeedback.for_user(user.id).negative.count
|
||||
positive = user.positive_feedback_count
|
||||
neutral = user.neutral_feedback_count
|
||||
negative = user.negative_feedback_count
|
||||
|
||||
template.link_to("positive:#{positive} neutral:#{neutral} negative:#{negative}", template.user_feedbacks_path(:search => {:user_id => user.id}))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user