Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count+Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
option_number.messages_for_issues=Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
update_score(option_number)
end
defmessges_for_issue_num(user,project=nil)
Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
end
#更新更改缺陷状态状态次数
defupdate_issues_status(user,type)
option_number=get_option_number(user,type)
option_number.issues_status=Journal.joins(:details,:user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
update_score(option_number)
end
defissues_status_num(user,project=nil)
Journal.joins(:details,:user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
end
#更新对留言的回复数量
defupdate_replay_for_message(user,type)
option_number=get_option_number(user,type)
@ -428,6 +442,10 @@ module UserScoreHelper
update_score(option_number)
end
defreplay_for_message_num(user,project=nil)
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
end
#更新对帖子的回复数量
defupdate_replay_for_memo(user,type)
option_number=get_option_number(user,type)
@ -435,6 +453,10 @@ module UserScoreHelper
update_score(option_number)
end
defreplay_for_memo_num(user,project=nil)
Message.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count+Memo.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count
end
#更新被关注的人数
defupdate_follow(user,type)
option_number=get_option_number(user,type)
@ -442,6 +464,10 @@ module UserScoreHelper
update_score(option_number)
end
deffollow_num(user,project=nil)
Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count
end
#更新帖子踩各项数量
defupdate_tread(user,type)
option_number=get_option_number(user,type)
@ -472,6 +498,31 @@ module UserScoreHelper
update_score(option_number)
end
deftread_num(user,project=nil)
result0=PraiseTread.where("praise_tread_object_type = 'Memo' || praise_tread_object_type = 'Message' and praise_or_tread = 0 and user_id = '#{user.id}'").all.count