Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
c042add122
|
@ -441,7 +441,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新对缺陷留言数
|
#更新对缺陷留言数
|
||||||
def update_messges_for_issue(user,type,project=nil)
|
def update_messges_for_issue(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
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
|
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
|
||||||
|
@ -464,7 +464,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新更改缺陷状态状态次数
|
#更新更改缺陷状态状态次数
|
||||||
def update_issues_status(user,type,project=nil)
|
def update_issues_status(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
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.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
|
||||||
|
@ -490,7 +490,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新对留言的回复数量
|
#更新对留言的回复数量
|
||||||
def update_replay_for_message(user,type,project=nil)
|
def update_replay_for_message(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
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
|
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
|
||||||
|
@ -514,7 +514,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新对帖子的回复数量
|
#更新对帖子的回复数量
|
||||||
def update_replay_for_memo(user,type,project=nil)
|
def update_replay_for_memo(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.replay_for_memo = replay_for_memo_num(user,project)#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
|
option_number.replay_for_memo = replay_for_memo_num(user,project)#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
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -552,7 +552,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新帖子踩各项数量
|
#更新帖子踩各项数量
|
||||||
def update_tread(user,type,project=nil)
|
def update_tread(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
tread_nums = tread_num(user,project)
|
tread_nums = tread_num(user,project)
|
||||||
option_number.tread = tread_nums[:tread]
|
option_number.tread = tread_nums[:tread]
|
||||||
option_number.tread_by_one = tread_nums[:tead_by_one]
|
option_number.tread_by_one = tread_nums[:tead_by_one]
|
||||||
|
@ -617,7 +617,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新帖子顶数量
|
#更新帖子顶数量
|
||||||
def update_praise(user,type,project=nil)
|
def update_praise(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
praise_nums = praise_num(user,project)
|
praise_nums = praise_num(user,project)
|
||||||
option_number.praise_by_one = praise_nums[:praise_by_one]
|
option_number.praise_by_one = praise_nums[:praise_by_one]
|
||||||
option_number.praise_by_two = praise_nums[:praise_by_two]
|
option_number.praise_by_two = praise_nums[:praise_by_two]
|
||||||
|
@ -682,7 +682,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新提交代码次数
|
#更新提交代码次数
|
||||||
def update_changeset(user,type,project=nil)
|
def update_changeset(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.changeset = changeset_num(user,project)#Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
|
option_number.changeset = changeset_num(user,project)#Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -698,7 +698,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新文档提交次数
|
#更新文档提交次数
|
||||||
def update_document(user,type,project=nil)
|
def update_document(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.document = document_num(user,project)#Document.includes(:user).where("user_id = '#{user.id}'").all.count
|
option_number.document = document_num(user,project)#Document.includes(:user).where("user_id = '#{user.id}'").all.count
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -714,7 +714,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新附件提交数量
|
#更新附件提交数量
|
||||||
def update_attachment(user,type,project=nil)
|
def update_attachment(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.attachment = attachment_num(user,project)#Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
|
option_number.attachment = attachment_num(user,project)#Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -729,7 +729,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新缺陷完成度次数
|
#更新缺陷完成度次数
|
||||||
def update_issue_done_ratio(user,type,project=nil)
|
def update_issue_done_ratio(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.issue_done_ratio = issue_done_ratio_num(user,project) #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
|
option_number.issue_done_ratio = issue_done_ratio_num(user,project) #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -745,7 +745,7 @@ FROM `users` where id = #{user.id}")
|
||||||
|
|
||||||
#更新发布缺陷次数
|
#更新发布缺陷次数
|
||||||
def update_post_issue(user,type,project=nil)
|
def update_post_issue(user,type,project=nil)
|
||||||
option_number = get_option_number(user,type)
|
option_number = get_option_number(user,type,project)
|
||||||
option_number.post_issue = post_issue_num(user,project) #Issue.includes(:author).where("author_id = '#{user.id}'").all.count
|
option_number.post_issue = post_issue_num(user,project) #Issue.includes(:author).where("author_id = '#{user.id}'").all.count
|
||||||
update_score(option_number)
|
update_score(option_number)
|
||||||
end
|
end
|
||||||
|
@ -758,6 +758,12 @@ FROM `users` where id = #{user.id}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#读取项目成员得分
|
||||||
|
def read_user_project_scores(user,project)
|
||||||
|
option_num = get_option_number(user,2,project)
|
||||||
|
option_num.total_score
|
||||||
|
end
|
||||||
|
|
||||||
def user_scores(user,type,project=nil)
|
def user_scores(user,type,project=nil)
|
||||||
ooption_num = get_option_number(user,type,project)
|
ooption_num = get_option_number(user,type,project)
|
||||||
update_memo_number(user,type,project)
|
update_memo_number(user,type,project)
|
||||||
|
|
|
@ -512,11 +512,18 @@ class Attachment < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
update_attachment(self.author,1)
|
update_attachment(self.author,1)
|
||||||
|
if self.container_type == 'Project'
|
||||||
|
update_attachment(self.author,2,self.container)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#删除附件时重新统计用户的附件数量得分
|
#删除附件时重新统计用户的附件数量得分
|
||||||
def down_user_score
|
def down_user_score
|
||||||
update_attachment(self.author,1)
|
update_attachment(self.author,1)
|
||||||
|
if self.container_type == 'Project'
|
||||||
|
update_attachment(self.author,2,self.container)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -308,12 +308,14 @@ class Changeset < ActiveRecord::Base
|
||||||
#更新用户等级
|
#更新用户等级
|
||||||
UserLevels.update_user_level(self.user)
|
UserLevels.update_user_level(self.user)
|
||||||
update_changeset(self.user,1)
|
update_changeset(self.user,1)
|
||||||
|
update_changeset(self.user,2,self.repository.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
#积分刷新
|
#积分刷新
|
||||||
def down_user_score
|
def down_user_score
|
||||||
UserLevels.update_user_level(self.user)
|
UserLevels.update_user_level(self.user)
|
||||||
update_changeset(self.user,1)
|
update_changeset(self.user,1)
|
||||||
|
update_changeset(self.user,2,self.repository.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,9 +69,11 @@ class Document < ActiveRecord::Base
|
||||||
def be_user_score
|
def be_user_score
|
||||||
UserScore.project(:push_document, self.user,self,{ document_id: self.id })
|
UserScore.project(:push_document, self.user,self,{ document_id: self.id })
|
||||||
update_document(self.user,1)
|
update_document(self.user,1)
|
||||||
|
update_document(self.user,2,self.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
def down_user_score
|
def down_user_score
|
||||||
update_document(self.user,1)
|
update_document(self.user,1)
|
||||||
|
update_document(self.user,2,self.project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1524,6 +1524,7 @@ class Issue < ActiveRecord::Base
|
||||||
def be_user_score_new_issue
|
def be_user_score_new_issue
|
||||||
UserScore.project(:post_issue, self.author,self, { issue_id: self.id })
|
UserScore.project(:post_issue, self.author,self, { issue_id: self.id })
|
||||||
update_post_issue(self.author,1)
|
update_post_issue(self.author,1)
|
||||||
|
update_post_issue(self.author,2,self.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
def down_user_score
|
def down_user_score
|
||||||
|
@ -1539,8 +1540,13 @@ class Issue < ActiveRecord::Base
|
||||||
# update_issues_status(self.author , 1)
|
# update_issues_status(self.author , 1)
|
||||||
#end
|
#end
|
||||||
update_post_issue(self.author,1)
|
update_post_issue(self.author,1)
|
||||||
update_issue_done_ratio(User.current,1)
|
#update_issue_done_ratio(self.author,1)
|
||||||
update_issues_status(self.author , 1)
|
#update_issues_status(self.author , 1)
|
||||||
|
|
||||||
|
update_post_issue(self.author,2,self.project)
|
||||||
|
#update_issue_done_ratio(self.author,2,self.project)
|
||||||
|
#update_issues_status(self.author , 2)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,7 @@ class Journal < ActiveRecord::Base
|
||||||
#协同得分加分
|
#协同得分加分
|
||||||
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
||||||
update_messges_for_issue(self.user,1)
|
update_messges_for_issue(self.user,1)
|
||||||
|
update_messges_for_issue(self.user,2,self.issue.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -173,6 +174,7 @@ class Journal < ActiveRecord::Base
|
||||||
#协同得分减分
|
#协同得分减分
|
||||||
UserScore.joint(:delete_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
UserScore.joint(:delete_issue_message, self.user,self.issue.author,self, { message_id: self.id })
|
||||||
update_messges_for_issue(self.user,1)
|
update_messges_for_issue(self.user,1)
|
||||||
|
update_messges_for_issue(self.user,2,self.issue.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,9 +46,15 @@ class JournalDetail < ActiveRecord::Base
|
||||||
#更新缺陷完成度
|
#更新缺陷完成度
|
||||||
if self.prop_key == 'done_ratio'
|
if self.prop_key == 'done_ratio'
|
||||||
update_issue_done_ratio(self.journal.user,1)
|
update_issue_done_ratio(self.journal.user,1)
|
||||||
|
unless self.journal.project.nil?
|
||||||
|
update_issue_done_ratio(self.journal.user,2,self.journal.project)
|
||||||
|
end
|
||||||
#更新缺陷状态
|
#更新缺陷状态
|
||||||
elsif self.prop_key == 'status_id'
|
elsif self.prop_key == 'status_id'
|
||||||
update_issues_status(self.journal.user , 1)
|
update_issues_status(self.journal.user , 1)
|
||||||
|
unless self.journal.project.nil?
|
||||||
|
update_issues_status(self.journal.user,2,self.journal.project)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,9 +63,16 @@ class JournalDetail < ActiveRecord::Base
|
||||||
|
|
||||||
if self.prop_key == 'done_ratio'
|
if self.prop_key == 'done_ratio'
|
||||||
update_issue_done_ratio(self.journal.user,1)
|
update_issue_done_ratio(self.journal.user,1)
|
||||||
|
unless self.journal.project.nil?
|
||||||
|
update_issue_done_ratio(self.journal.user,2,self.journal.project)
|
||||||
|
end
|
||||||
|
|
||||||
#更新缺陷状态
|
#更新缺陷状态
|
||||||
elsif self.prop_key == 'status_id'
|
elsif self.prop_key == 'status_id'
|
||||||
update_issues_status(self.journal.user, 1)
|
update_issues_status(self.journal.user, 1)
|
||||||
|
unless self.journal.project.nil?
|
||||||
|
update_issues_status(self.journal.user,2,self.journal.project)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,9 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
#协同得分加分
|
#协同得分加分
|
||||||
UserScore.joint(:reply_message, self.user,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
|
UserScore.joint(:reply_message, self.user,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
|
||||||
update_replay_for_message(self.user,1)
|
update_replay_for_message(self.user,1)
|
||||||
|
if self.jour_type == "Project"
|
||||||
|
update_replay_for_message(self.user,2,self.jour)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# 更新用户分数 -by zjc
|
# 更新用户分数 -by zjc
|
||||||
|
@ -153,6 +156,9 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
#协同得分减分
|
#协同得分减分
|
||||||
UserScore.joint(:reply_message_delete, self.user,User.find(self.reply_id), { journals_for_messages_id: self.id })
|
UserScore.joint(:reply_message_delete, self.user,User.find(self.reply_id), { journals_for_messages_id: self.id })
|
||||||
update_replay_for_message(self.user,1)
|
update_replay_for_message(self.user,1)
|
||||||
|
if self.jour_type == "Project"
|
||||||
|
update_replay_for_message(self.user,2,self.jour)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -151,6 +151,7 @@ class Memo < ActiveRecord::Base
|
||||||
if self.parent_id.nil?
|
if self.parent_id.nil?
|
||||||
UserScore.joint(:post_message, User.current,nil,self ,{ memo_id: self.id })
|
UserScore.joint(:post_message, User.current,nil,self ,{ memo_id: self.id })
|
||||||
update_memo_number(User.current,1)
|
update_memo_number(User.current,1)
|
||||||
|
|
||||||
#新建memo且有parent的为回帖
|
#新建memo且有parent的为回帖
|
||||||
elsif !self.parent_id.nil?
|
elsif !self.parent_id.nil?
|
||||||
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { memo_id: self.id })
|
UserScore.joint(:reply_posting, User.current,self.parent.author,self, { memo_id: self.id })
|
||||||
|
|
|
@ -152,11 +152,17 @@ class Message < ActiveRecord::Base
|
||||||
#新建message且无parent的为发帖
|
#新建message且无parent的为发帖
|
||||||
if self.parent_id.nil? && !self.board.project.nil?
|
if self.parent_id.nil? && !self.board.project.nil?
|
||||||
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
|
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
|
||||||
update_memo_number(User.current,1)
|
update_memo_number(self.author,1)
|
||||||
|
if self.board.project_id != -1
|
||||||
|
update_memo_number(self.author,2,self.board.project)
|
||||||
|
end
|
||||||
#新建message且有parent的为回帖
|
#新建message且有parent的为回帖
|
||||||
elsif !self.parent_id.nil? && !self.board.project.nil?
|
elsif !self.parent_id.nil? && !self.board.project.nil?
|
||||||
UserScore.joint(:reply_posting, self.author,self.parent.author,self, { message_id: self.id })
|
UserScore.joint(:reply_posting, self.author,self.parent.author,self, { message_id: self.id })
|
||||||
update_replay_for_memo(User.current,1)
|
update_replay_for_memo(self.author,1)
|
||||||
|
if self.board.project_id != -1
|
||||||
|
update_replay_for_memo(self.author,2,self.board.project)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -165,9 +171,15 @@ class Message < ActiveRecord::Base
|
||||||
if self.parent_id.nil? && !self.board.project.nil?
|
if self.parent_id.nil? && !self.board.project.nil?
|
||||||
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
|
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
|
||||||
update_memo_number(User.current,1)
|
update_memo_number(User.current,1)
|
||||||
|
if self.board.project_id != -1
|
||||||
|
update_memo_number(self.author,2,self.board.project)
|
||||||
|
end
|
||||||
elsif !self.parent_id.nil? && !self.board.project.nil?
|
elsif !self.parent_id.nil? && !self.board.project.nil?
|
||||||
UserScore.joint(:reply_deleting, self.author,self.parent.author,self, { message_id: self.id })
|
UserScore.joint(:reply_deleting, self.author,self.parent.author,self, { message_id: self.id })
|
||||||
update_replay_for_memo(User.current,1)
|
update_replay_for_memo(User.current,1)
|
||||||
|
if self.board.project_id != -1
|
||||||
|
update_replay_for_memo(self.author,2,self.board.project)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,14 +43,21 @@ class PraiseTread < ActiveRecord::Base
|
||||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||||
target_user = obj.author
|
target_user = obj.author
|
||||||
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||||
update_tread(User.current,1)
|
update_tread(self.user,1)
|
||||||
update_tread(target_user,1)
|
update_tread(target_user,1)
|
||||||
|
unless self.project.nil?
|
||||||
|
update_tread(self.user,2,self.project)
|
||||||
|
update_tread(target_user,2,self.project)
|
||||||
|
end
|
||||||
#顶贴吧或讨论区帖子
|
#顶贴吧或讨论区帖子
|
||||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||||
target_user = obj.author
|
target_user = obj.author
|
||||||
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||||
update_praise(target_user,1)
|
update_praise(target_user,1)
|
||||||
|
unless self.project.nil?
|
||||||
|
update_praise(target_user,2,self.project)
|
||||||
|
end
|
||||||
#更新用户等级
|
#更新用户等级
|
||||||
UserLevels.update_user_level(target_user)
|
UserLevels.update_user_level(target_user)
|
||||||
end
|
end
|
||||||
|
@ -62,14 +69,21 @@ class PraiseTread < ActiveRecord::Base
|
||||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||||
target_user = obj.author
|
target_user = obj.author
|
||||||
#UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
#UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
|
||||||
update_tread(User.current,1)
|
update_tread(self.user,1)
|
||||||
update_tread(target_user,1)
|
update_tread(target_user,1)
|
||||||
|
unless self.project.nil?
|
||||||
|
update_tread(self.user,2,self.project)
|
||||||
|
update_tread(target_user,2,self.project)
|
||||||
|
end
|
||||||
#顶贴吧或讨论区帖子
|
#顶贴吧或讨论区帖子
|
||||||
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
|
||||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||||
target_user = obj.author
|
target_user = obj.author
|
||||||
#UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
#UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
|
||||||
update_praise(target_user,1)
|
update_praise(target_user,1)
|
||||||
|
unless self.project.nil?
|
||||||
|
update_praise(target_user,2,self.project)
|
||||||
|
end
|
||||||
#更新用户等级
|
#更新用户等级
|
||||||
UserLevels.update_user_level(target_user)
|
UserLevels.update_user_level(target_user)
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
|
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
|
||||||
<div class="clear avatar_user">
|
<div class="clear avatar_user">
|
||||||
<p> <!--user_scores(member.user,2,@project).total_score).to_i UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i-->
|
<p> <!--user_scores(member.user,2,@project).total_score).to_i UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i-->
|
||||||
<%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= format("%.2f" ,user_scores(member.user,2,@project).total_score).to_i %></span>
|
<%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= format("%.2f" ,read_user_project_scores(member.user,@project)).to_i %></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue