option_number=OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
else
option_number=OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project_id}'");
option_number=OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project.id}'");
end
result=nil
@ -402,9 +405,9 @@ module UserScoreHelper
end
#更新发帖数
defupdate_memo_number(user,type)
option_number=get_option_number(user,type)
option_number.memo=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.memo=memo_num(user,project)#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
option_number.messages_for_issues=messges_for_issue_num(user,project)#Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
update_score(option_number)
end
@ -434,9 +437,9 @@ module UserScoreHelper
end
#更新更改缺陷状态状态次数
defupdate_issues_status(user,type)
defupdate_issues_status(user,type,project=nil)
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
option_number.issues_status=issues_status_num(user,project)#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
option_number.replay_for_message=JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
option_number.replay_for_message=replay_for_message_num(user,project)#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count