1、去除不用了的旧的积分代码。2、将刷新提交次数功能修改(原来是在显示项目或个人信息的页面之前调用repository.fetch_changesets刷新changeset,修改为创建changeset对象后马上调用repository.fetch_changesets方法刷新changeset对象,注意:尚需测试)
This commit is contained in:
parent
ddc8da99e4
commit
74ba4384b1
|
@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
|
||||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||||
before_filter :file, :statistics, :watcherlist
|
before_filter :file, :statistics, :watcherlist
|
||||||
before_filter :find_project_repository, :only => [:show]
|
#before_filter :find_project_repository, :only => [:show]
|
||||||
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
|
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
|
||||||
before_filter :memberAccess, only: :member
|
before_filter :memberAccess, only: :member
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#william
|
#william
|
||||||
before_filter :require_login, :only => [:tag_save,:tag_saveEx]
|
before_filter :require_login, :only => [:tag_save,:tag_saveEx]
|
||||||
|
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
|
||||||
|
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
|
@ -68,6 +69,17 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# fq
|
# fq
|
||||||
helper :words
|
helper :words
|
||||||
|
|
||||||
|
def refresh_changests
|
||||||
|
if !(@user.nil?) && !(@user.memberships.nil?)
|
||||||
|
@user.memberships.each do |member|
|
||||||
|
unless member.project.nil?
|
||||||
|
member.project.repository.fetch_changesets if Setting.autofetch_changesets?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#added by young
|
#added by young
|
||||||
def user_projects
|
def user_projects
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Changeset < ActiveRecord::Base
|
||||||
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
|
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
|
||||||
}
|
}
|
||||||
|
|
||||||
after_create :scan_for_issues,:be_user_score # user_score
|
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
|
||||||
after_update :be_user_score
|
after_update :be_user_score
|
||||||
after_destroy :down_user_score
|
after_destroy :down_user_score
|
||||||
before_create :before_create_cs
|
before_create :before_create_cs
|
||||||
|
@ -305,9 +305,9 @@ class Changeset < ActiveRecord::Base
|
||||||
# update user score
|
# update user score
|
||||||
def be_user_score
|
def be_user_score
|
||||||
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
|
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
|
||||||
#更新用户等级
|
|
||||||
UserLevels.update_user_level(self.user)
|
|
||||||
unless self.user.nil?
|
unless self.user.nil?
|
||||||
|
#更新用户等级
|
||||||
|
UserLevels.update_user_level(self.user)
|
||||||
update_changeset(self.user,1)
|
update_changeset(self.user,1)
|
||||||
update_changeset(self.user,2,self.repository.project)
|
update_changeset(self.user,2,self.repository.project)
|
||||||
end
|
end
|
||||||
|
@ -321,4 +321,11 @@ class Changeset < ActiveRecord::Base
|
||||||
update_changeset(self.user,2,self.repository.project)
|
update_changeset(self.user,2,self.repository.project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#刷新本次提交(补全相关信息如:user_id等)
|
||||||
|
def refresh_changests
|
||||||
|
unless self.repository.nil?
|
||||||
|
self.repository.fetch_changesets if Setting.autofetch_changesets?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,32 +1,6 @@
|
||||||
<!-- added by bai -->
|
<!-- added by bai -->
|
||||||
<div class="autoscroll">
|
<div class="autoscroll">
|
||||||
<% for user in @users -%>
|
<% for user in @users -%>
|
||||||
<!-- added by bai -->
|
|
||||||
<% messages_count = user.messages.count %>
|
|
||||||
<% messages_score = messages_count * 0.05%>
|
|
||||||
<% finall_messages_score = messages_score %>
|
|
||||||
|
|
||||||
<% journals_count = user.journals.count %>
|
|
||||||
<% journals_score = journals_count * 0.1 %>
|
|
||||||
<% user_changesets_count = user.changesets.count %>
|
|
||||||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
|
||||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
|
||||||
|
|
||||||
<% journals_for_messages_count = user.journals_messages.count %>
|
|
||||||
<% activities_count = user.activities.count %>
|
|
||||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
|
||||||
<% activities_score = activities_count * 0.2 %>
|
|
||||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
|
||||||
|
|
||||||
<% news_count = user.news.count %>
|
|
||||||
<% news_score = news_count * 0.1 %>
|
|
||||||
<% wiki_contents_count = user.wiki_contents.count %>
|
|
||||||
<% wiki_contents_score = wiki_contents_count * 0.1 %>
|
|
||||||
<% comments_count = user.comments.count %>
|
|
||||||
<% comments_score = comments_count * 0.1 %>
|
|
||||||
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
|
|
||||||
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
|
|
||||||
<!-- end -->
|
|
||||||
<div class="well">
|
<div class="well">
|
||||||
|
|
||||||
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>
|
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>
|
||||||
|
|
Loading…
Reference in New Issue