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