部分私有的项目提交次数显示问题
This commit is contained in:
parent
c6271e2aa9
commit
17e6f0ee4f
|
@ -79,6 +79,9 @@ module ProjectScoreHelper
|
||||||
else
|
else
|
||||||
ps = pss.first
|
ps = pss.first
|
||||||
ps.grade = result
|
ps.grade = result
|
||||||
|
if ps.changesets_count.nil? || ps.changesets_count == ""
|
||||||
|
ps.changesets_count = project.changesets.count
|
||||||
|
end
|
||||||
ps.save
|
ps.save
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
|
|
|
@ -337,12 +337,15 @@ module UserScoreHelper
|
||||||
:activity => activity, :file => file, :issue => issue, :level => level)
|
:activity => activity, :file => file, :issue => issue, :level => level)
|
||||||
end
|
end
|
||||||
|
|
||||||
#====================================================================================================
|
#========================================================================================================
|
||||||
def get_option_number(user,type,project_id=nil)
|
#个人得分统计
|
||||||
if project_id.nil?
|
#========================================================================================================
|
||||||
|
#type 1:个人得分、2:个人在项目project中的得分
|
||||||
|
def get_option_number(user,type,project=nil)
|
||||||
|
if project.nil?
|
||||||
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
|
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
result = nil
|
result = nil
|
||||||
|
@ -402,9 +405,9 @@ module UserScoreHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新发帖数
|
#更新发帖数
|
||||||
def update_memo_number(user,type)
|
def update_memo_number(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
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
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -419,9 +422,9 @@ module UserScoreHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新对缺陷留言数
|
#更新对缺陷留言数
|
||||||
def update_messges_for_issue(user,type)
|
def update_messges_for_issue(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type)
|
||||||
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)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -434,9 +437,9 @@ module UserScoreHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新更改缺陷状态状态次数
|
#更新更改缺陷状态状态次数
|
||||||
def update_issues_status(user,type)
|
def update_issues_status(user,type,project=nil)
|
||||||
option_number = get_option_number(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
|
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
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -450,14 +453,19 @@ module UserScoreHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新对留言的回复数量
|
#更新对留言的回复数量
|
||||||
def update_replay_for_message(user,type)
|
def update_replay_for_message(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type)
|
||||||
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
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
#====================================contiue here=====================================================
|
||||||
def replay_for_message_num(user)
|
def replay_for_message_num(user,project=nil)
|
||||||
|
if project.nil?
|
||||||
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
|
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新对帖子的回复数量
|
#更新对帖子的回复数量
|
||||||
|
@ -727,6 +735,9 @@ module UserScoreHelper
|
||||||
else
|
else
|
||||||
Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
|
Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_scores(user,type)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue