Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
241b1f2dc6
|
@ -25,6 +25,16 @@ class PraiseTread < ActiveRecord::Base
|
|||
return @obj
|
||||
end
|
||||
|
||||
# 获取裁定对象为Message时Message所属的项目或课程
|
||||
def project
|
||||
project = nil
|
||||
if self.praise_tread_object_type == 'Message'
|
||||
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
|
||||
project = obj.project
|
||||
end
|
||||
project
|
||||
end
|
||||
|
||||
#更新用户分数 - by zjc
|
||||
def be_user_score
|
||||
#踩贴吧或讨论区帖子
|
||||
|
|
|
@ -4,7 +4,7 @@ class UserLevels < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
|
||||
#获取user的等级 -by zjc
|
||||
def get_level(user)
|
||||
def self.get_level(user)
|
||||
unless user.nil?
|
||||
if user.level.nil?
|
||||
UserLevels.update_user_level(user)
|
||||
|
|
|
@ -51,11 +51,23 @@ class UserScore < ActiveRecord::Base
|
|||
def self.joint(operate, current_user, target_user,obj, options={})
|
||||
current_user, target_user = get_users(current_user, target_user)
|
||||
user_score = current_user.user_score_attr
|
||||
user_grade = nil #项目个人得分
|
||||
project = obj.project
|
||||
unless project.nil? && project.project_type == 0
|
||||
user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
|
||||
if user_grade.nil?
|
||||
user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
|
||||
end
|
||||
end
|
||||
case operate
|
||||
when :post_message # current_user 发帖了 Add Message
|
||||
user_score.collaboration = user_score.collaboration.to_i + 2
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:score_type => "collaboration",:score_action => "post_message",:user_id => current_user.id,:old_score => user_score.collaboration - 2,:new_score => user_score.collaboration,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade.to_i + 2
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:score_type => "collaboration",:score_action => "post_message",:user_id => current_user.id,:old_score => user_score.collaboration - 2,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} posting a message. options => (#{options.to_s})"
|
||||
#when :delete_message # current_user 删帖了 Delete Message
|
||||
# user_score.collaboration = user_score.collaboration.to_i - 2
|
||||
|
@ -64,7 +76,11 @@ class UserScore < ActiveRecord::Base
|
|||
when :post_issue_message # current_user 对 target_user 的缺陷留言了 Add Journal
|
||||
user_score.collaboration = user_score.collaboration.to_i + 1
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "post_issue_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade.to_i + 1
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "post_issue_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} posting a issue. options => (#{options.to_s})"
|
||||
#when :delete_issue_message # current_user 删除了 对 target_user 的缺陷留言了 Delete Journal
|
||||
# user_score.collaboration = user_score.collaboration.to_i - 1
|
||||
|
@ -73,12 +89,20 @@ class UserScore < ActiveRecord::Base
|
|||
when :change_issue_status # current_user 更改了缺陷的状态 Changed Issue
|
||||
user_score.collaboration = user_score.collaboration.to_i + 1
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "collaboration",:score_action => "change_issue_status",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade.to_i + 1
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "collaboration",:score_action => "change_issue_status",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} change issue status. options => (#{options.to_s})"
|
||||
when :reply_message # current_user 对 target_user 留言的回复 Add Journals_for_messages
|
||||
user_score.collaboration = user_score.collaboration.to_i + 1
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade.to_i + 1
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_message",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply message. options => (#{options.to_s})"
|
||||
#when :reply_message_delete # current_user 删除了对 target_user 留言的回复 delete Journals_for_messages
|
||||
# user_score.collaboration = user_score.collaboration.to_i - 1
|
||||
|
@ -87,7 +111,11 @@ class UserScore < ActiveRecord::Base
|
|||
when :reply_posting # current_user 对 target_user 帖子的回复 Add Message
|
||||
user_score.collaboration = user_score.collaboration.to_i + 1
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_posting",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade.to_i + 1
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "collaboration",:score_action => "reply_posting",:user_id => current_user.id,:old_score => user_score.collaboration - 1,:new_score => user_score.collaboration,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#joint] ===> User: #{current_user} reply posting. options => (#{options.to_s})"
|
||||
#when :reply_deleting # current_user 删除了 对 target_user 帖子的回复 Delete Message
|
||||
# user_score.collaboration = user_score.collaboration.to_i - 1
|
||||
|
@ -118,12 +146,12 @@ class UserScore < ActiveRecord::Base
|
|||
when :followed_by # current_user 关注了target_user Add watcher
|
||||
user_score.influence = user_score.influence.to_i + 2
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "followed_by",:user_id => target_user.id,:old_score => user_score.influence - 2,:new_score => user_score.influence,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "followed_by",:user_id => target_user.id,:old_score => user_score.influence - 2,:new_score => user_score.influence,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#influence] ===> User: #{current_user} be followed. options => (#{options.to_s})"
|
||||
when :cancel_followed # current_uer 取消了对 target_user的关注 delete watcher
|
||||
user_score.influence = user_score.influence.to_i - 2
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "cancel_followed",:user_id => target_user.id,:old_score => user_score.influence + 2,:new_score => user_score.influence,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "influence",:score_action => "cancel_followed",:user_id => target_user.id,:old_score => user_score.influence + 2,:new_score => user_score.influence,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.info "[UserScore#influence] ===> User: #{current_user} canceled followed. options => (#{options.to_s})"
|
||||
else
|
||||
Rails.logger.error "[UserScore#influence] ===> #{operate} is not define."
|
||||
|
@ -147,47 +175,91 @@ class UserScore < ActiveRecord::Base
|
|||
current_user, target_user = get_users(current_user, target_user)
|
||||
current_user_score = current_user.user_score_attr
|
||||
target_user_score = target_user.user_score_attr
|
||||
current_user_grade = nil #项目个人得分
|
||||
target_user_grade = nil
|
||||
project = obj.project
|
||||
unless project.nil? && project.project_type == 0
|
||||
current_user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
|
||||
target_user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||
if current_user_grade.nil?
|
||||
current_user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
|
||||
end
|
||||
if target_user_grade.nil?
|
||||
target_user_grade = UserGrade.create(:user_id => target_user.id,:project_id => project.id)
|
||||
end
|
||||
end
|
||||
case operate
|
||||
# when :treading # current_user 踩了 target_user 的帖子
|
||||
# Rails.logger.info "[UserScore#skill] ===> User: #{current_user} treading #{target_user}'s posting. options => (#{options.to_s})"
|
||||
when :treaded_by_user # current_user 踩了 target_user 的帖子
|
||||
current_user_score.skill = current_user_score.skill.to_i - 2 #踩别人的帖子减2分 add praise_tread
|
||||
current_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => current_user.id,:old_score => current_user_score.skill + 2,:new_score => current_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless current_user_grade.nil?
|
||||
current_user_grade.grade = current_user_grade.grade - 2
|
||||
current_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => current_user.id,:old_score => current_user_score.skill + 2,:new_score => current_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
if current_user.id == target_user.id
|
||||
target_user.reload
|
||||
target_user_score = target_user.user_score_attr
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.reload
|
||||
end
|
||||
end
|
||||
level = current_user.get_level
|
||||
level = UserLevels.get_level(current_user)
|
||||
if level == 1
|
||||
target_user_score.skill = target_user_score.skill.to_i - 2 #帖子被一级会员踩-2分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 2,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade - 2
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 2,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
elsif level == 2
|
||||
target_user_score.skill = target_user_score.skill.to_i - 4 #帖子被二级会员踩-4分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 4,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade - 4
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 4,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
elsif level == 3
|
||||
target_user_score.skill = target_user_score.skill.to_i - 6 #帖子被三级会员踩-6分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 6,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade - 6
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "treaded_by_user",:user_id => target_user.id,:old_score => target_user_score.skill + 6,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
end
|
||||
|
||||
Rails.logger.info "[UserScore#skill] ===> User: #{current_user} treaded_by #{target_user}. options => (#{options.to_s})"
|
||||
when :praised_by_user # current_user 顶了 target_user 的帖子
|
||||
level = current_user.get_level
|
||||
level = UserLevels.get_level(current_user)
|
||||
if level == 1
|
||||
target_user_score.skill = target_user_score.skill.to_i + 4 #帖子被一级会员顶+4分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 4,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade + 4
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 4,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
elsif level == 2
|
||||
target_user_score.skill = target_user_score.skill.to_i + 6 #帖子被二级会员顶+6分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 6,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade + 6
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 6,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
elsif level == 3
|
||||
target_user_score.skill = target_user_score.skill.to_i + 8 #帖子被三级会员顶+8分 add praise_tread
|
||||
target_user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 8,:new_score => target_user_score.skill,:current_user_level => current_user.get_level,:target_user_level => target_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless target_user_grade.nil?
|
||||
target_user_grade.grade = target_user_grade.grade + 8
|
||||
target_user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id ,:target_user_id =>target_user.id, :score_type => "skill",:score_action => "praised_by_user",:user_id => target_user.id,:old_score => target_user_score.skill - 8,:new_score => target_user_score.skill,:current_user_level => UserLevels.get_level(current_user),:target_user_level => UserLevels.get_level(target_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
end
|
||||
Rails.logger.info "[UserScore#skill] ===> User: #{current_user} praised_by #{target_user}. options => (#{options.to_s})"
|
||||
else
|
||||
|
@ -211,32 +283,60 @@ class UserScore < ActiveRecord::Base
|
|||
def self.project(operate, current_user,obj, options={})
|
||||
current_user, target_user = get_users(current_user, nil)
|
||||
user_score = current_user.try(:user_score_attr)
|
||||
user_grade = nil #项目个人得分
|
||||
project = obj.project
|
||||
unless project.nil? && project.project_type == 0
|
||||
user_grade = UserGrade.find_by_user_id_and_project_id(current_user.id, project.id)
|
||||
if user_grade.nil?
|
||||
user_grade = UserGrade.create(:user_id => current_user.id,:project_id => project.id)
|
||||
end
|
||||
end
|
||||
return false if current_user.nil?
|
||||
case operate
|
||||
when :push_code # current_user 提交了代码 changeset
|
||||
user_score = user_score.active.to_i + 4
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_code",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade + 4
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_code",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed code one time. options => (#{options.to_s})"
|
||||
when :push_document # current_user 提交了文档 document
|
||||
user_score.active = user_score.active.to_i + 4
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_document",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade + 4
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_document",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed a document. options => (#{options.to_s})"
|
||||
when :push_file # current_user 提交了附件 attachment
|
||||
user_score.active = user_score.active.to_i + 4
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_file",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade + 4
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "push_file",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] pushed a file. options => (#{options.to_s})"
|
||||
when :update_issue_ratio # current_user 更新了缺陷完成度 issue
|
||||
user_score.active = user_score.active.to_i + 2
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "update_issue_ratio",:user_id => current_user.id,:old_score => user_score.active - 2,:new_score => user_score.active,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade + 2
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "update_issue_ratio",:user_id => current_user.id,:old_score => user_score.active - 2,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] updated issue ratio. options => (#{options.to_s})"
|
||||
when :post_issue # current_user 发布了缺陷 issue
|
||||
user_score.active = user_score.active.to_i + 4
|
||||
user_score.save
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "post_issue",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => current_user.get_level,:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
unless user_grade.nil?
|
||||
user_grade.grade = user_grade.grade + 4
|
||||
user_grade.save
|
||||
end
|
||||
create_score_changed_details({:current_user_id => current_user.id , :score_type => "active",:score_action => "post_issue",:user_id => current_user.id,:old_score => user_score.active - 4,:new_score => user_score.active,:current_user_level => UserLevels.get_level(current_user),:score_changeable_obj_id=> obj.id,:score_changeable_obj_type => obj.class.to_s})
|
||||
Rails.logger.debug "[UserScore#project] ===> User: [#{current_user.id},#{current_user.name}] posting issue. options => (#{options.to_s})"
|
||||
else
|
||||
Rails.logger.error "[UserScore#project] ===> #{operate} is not define."
|
||||
|
|
Loading…
Reference in New Issue