个人分数
This commit is contained in:
parent
db1874fa07
commit
13fdbde1cf
|
@ -46,7 +46,8 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
|
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
|
||||||
before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
|
before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
|
||||||
:statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share]
|
:statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
|
||||||
|
:show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
|
||||||
before_filter :authorize_global, :only => [:new, :create]
|
before_filter :authorize_global, :only => [:new, :create]
|
||||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||||
#by young
|
#by young
|
||||||
|
@ -760,6 +761,31 @@ class ProjectsController < ApplicationController
|
||||||
@project = nil
|
@project = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# added by bai
|
||||||
|
def show_projects_score
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def issue_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def news_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def file_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def code_submit_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def projects_topic_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
# end
|
||||||
private
|
private
|
||||||
|
|
||||||
# Validates parent_id param according to user's permissions
|
# Validates parent_id param according to user's permissions
|
||||||
|
|
|
@ -30,11 +30,13 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
|
|
||||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
|
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
|
||||||
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score]
|
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||||
|
:activity_score_index, :influence_score_index, :score_index]
|
||||||
#edit has been deleted by huang, 2013-9-23
|
#edit has been deleted by huang, 2013-9-23
|
||||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks,
|
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||||
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
|
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||||
:watch_projects, :show_score]
|
:watch_bids, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||||
|
:activity_score_index, :influence_score_index, :score_index]
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||||
|
|
||||||
#william
|
#william
|
||||||
|
@ -86,9 +88,11 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# added by bai
|
||||||
def show_score
|
def show_score
|
||||||
|
|
||||||
end
|
end
|
||||||
|
# end
|
||||||
|
|
||||||
##added by fq
|
##added by fq
|
||||||
def watch_bids
|
def watch_bids
|
||||||
|
@ -682,6 +686,27 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# added by bai
|
||||||
|
def topic_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def project_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def activity_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def influence_score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def score_index
|
||||||
|
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -81,13 +81,12 @@ class Project < ActiveRecord::Base
|
||||||
:order => "#{CustomField.table_name}.position",
|
:order => "#{CustomField.table_name}.position",
|
||||||
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
|
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
|
||||||
:association_foreign_key => 'custom_field_id'
|
:association_foreign_key => 'custom_field_id'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||||
has_many :project_tags, :class_name => 'ProjectTags'
|
has_many :project_tags, :class_name => 'ProjectTags'
|
||||||
|
|
||||||
|
has_many :journals
|
||||||
|
|
||||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||||
acts_as_attachable :view_permission => :view_files,
|
acts_as_attachable :view_permission => :view_files,
|
||||||
:delete_permission => :manage_files
|
:delete_permission => :manage_files
|
||||||
|
|
|
@ -90,8 +90,15 @@ class User < Principal
|
||||||
has_many :students_for_courses
|
has_many :students_for_courses
|
||||||
has_many :courses, :through => :students_for_courses, :source => :project
|
has_many :courses, :through => :students_for_courses, :source => :project
|
||||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||||
|
####
|
||||||
|
# added by bai
|
||||||
has_many :join_in_contests, :dependent => :destroy
|
has_many :join_in_contests, :dependent => :destroy
|
||||||
#####
|
has_many :news, :foreign_key => 'author_id'
|
||||||
|
has_many :comments, :foreign_key => 'author_id'
|
||||||
|
has_many :wiki_contents, :foreign_key => 'author_id'
|
||||||
|
has_many :journals
|
||||||
|
has_many :messages, :foreign_key => 'author_id'
|
||||||
|
# end
|
||||||
|
|
||||||
######added by nie
|
######added by nie
|
||||||
has_many :project_infos, :dependent => :destroy
|
has_many :project_infos, :dependent => :destroy
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# encoding: utf-8
|
||||||
=begin
|
=begin
|
||||||
identity字段含义
|
identity字段含义
|
||||||
0 教师教授
|
0 教师教授
|
||||||
|
@ -25,7 +26,7 @@ class UserExtensions < ActiveRecord::Base
|
||||||
return self.brief_introduction
|
return self.brief_introduction
|
||||||
end
|
end
|
||||||
|
|
||||||
# added by bai
|
# added by bai
|
||||||
def show_identity
|
def show_identity
|
||||||
if self.identity == 0
|
if self.identity == 0
|
||||||
user_identity = '教师'
|
user_identity = '教师'
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<%= join_in_course(@project, User.current) %></div>
|
<%= join_in_course(@project, User.current) %></div>
|
||||||
<% end %> </div>
|
<% end %> </div>1111
|
||||||
<% unless User.current.member_of?(@project) %>
|
<% unless User.current.member_of?(@project) %>
|
||||||
<!-- <%= image_tag "/images/fav.png" %> -->
|
<!-- <%= image_tag "/images/fav.png" %> -->
|
||||||
<div style="padding-right: 10px">
|
<div style="padding-right: 10px">
|
||||||
|
|
|
@ -57,6 +57,41 @@
|
||||||
<div class="info-course">
|
<div class="info-course">
|
||||||
<%= @project.name %>
|
<%= @project.name %>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<!-- added by bai 增加项目得分 -->
|
||||||
|
<% issue_count = @project.issues.count %>
|
||||||
|
<% issue_journal_count = @project.issue_changes.count %>
|
||||||
|
<% issue_score = issue_count * 0.2 %>
|
||||||
|
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||||
|
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||||
|
|
||||||
|
<% new_count = @project.news.count %>
|
||||||
|
<% new_score = new_count * 0.1 %>
|
||||||
|
<% finall_new_score = new_score %>
|
||||||
|
|
||||||
|
<% document_count = @project.documents.count %>
|
||||||
|
<% file_score = document_count * 0.1 %>
|
||||||
|
<% finall_file_score = file_score %>
|
||||||
|
|
||||||
|
<% changeset_count = @project.changesets.count %>
|
||||||
|
<% code_submit_score = changeset_count * 0.3 %>
|
||||||
|
<% finall_code_submit_score = code_submit_score %>
|
||||||
|
|
||||||
|
<% board_message_count = 0 %>
|
||||||
|
<% @project.boards.each do |board| %>
|
||||||
|
<% board_message_count += board.messages_count %>
|
||||||
|
<% end %>
|
||||||
|
<% topic_score = board_message_count * 0.1 %>
|
||||||
|
<% finall_topic_score = topic_score %>
|
||||||
|
|
||||||
|
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||||
|
|
||||||
|
<% if @project.project_type == 0 %>
|
||||||
|
<%= link_to(l(:label_project_grade), {:controller => 'projects', :action => 'show_projects_score', :remote => true, :id => @project.id})%> :
|
||||||
|
<span style='color:#ec6300'><%= format("%.2f" , finall_project_score ).to_f %></span>
|
||||||
|
<% end %>
|
||||||
|
<!-- end -->
|
||||||
|
</div>
|
||||||
<div style="margin-left: 20px;">
|
<div style="margin-left: 20px;">
|
||||||
|
|
||||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
||||||
|
|
|
@ -67,7 +67,36 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- added by bai 增加个人得分 -->
|
<!-- added by bai 增加个人得分 -->
|
||||||
<tr><td class="buttons_for_course" style="margin-top:30px;margin-left:144px"><%= link_to(l(:label_user_grade), {:controller => 'users', :action => 'show_score', :remote => true, :id => @user.id})%>: <span style="color:#ec6300"><%= @user.user_status.grade %></span></td></tr>
|
<% 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_for_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 %>
|
||||||
|
|
||||||
|
<tr><td class="buttons_for_course" style="margin-top:30px;margin-left:144px">
|
||||||
|
<%= link_to(l(:label_user_grade), {:controller => 'users', :action => 'show_score', :remote => true, :id => @user.id})%>:
|
||||||
|
<span style="color:#ec6300"><%= format("%.2f" , finall_user_score).to_f %></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<% changeset_count = @project.changesets.count %>
|
||||||
|
<% code_submit_score = changeset_count * 0.3 %>
|
||||||
|
<% finall_code_submit_score = code_submit_score %>
|
||||||
|
<div><%= l(:label_code_submit_number) %> * 0.3 = <%= changeset_count %> * 0.3 = <%= format("%.2f" , code_submit_score).to_f %></div>
|
||||||
|
<div><%= l(:label_code_submit_score) %> = <%= format("%.2f" , finall_code_submit_score).to_f %></div>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<% document_count = @project.documents.count %>
|
||||||
|
<% file_score = document_count * 0.1 %>
|
||||||
|
<% finall_file_score = file_score %>
|
||||||
|
<div><%= l(:label_file_number) %> * 0.1 = <%= document_count %> * 0.1 = <%= format("%.2f" , file_score).to_f %></div>
|
||||||
|
<div><%= l(:label_file_score) %> = <%= format("%.2f" , finall_file_score).to_f %></div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<% issue_count = @project.issues.count %>
|
||||||
|
<% issue_journal_count = @project.issue_changes.count %>
|
||||||
|
<% issue_score = issue_count * 0.2 %>
|
||||||
|
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||||
|
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||||
|
<div><%= l(:label_issue_number) %> * 0.2 = <%= issue_count %> * 0.2 = <%= format("%.2f" , issue_score).to_f %></div>
|
||||||
|
<div><%= l(:label_issue_journal_number) %> * 0.1 = <%= issue_journal_count %> * 0.1 = <%= format("%.2f" , issue_journal_score).to_f %></div>
|
||||||
|
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_score).to_f %> + <%= format("%.2f" , issue_journal_score).to_f %>
|
||||||
|
= <%= format("%.2f" , finall_issue_score).to_f %></div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,5 @@
|
||||||
|
<% new_count = @project.news.count %>
|
||||||
|
<% new_score = new_count * 0.1 %>
|
||||||
|
<% finall_new_score = new_score %>
|
||||||
|
<div><%= l(:label_new_number) %> * 0.1 = <%= new_count %> * 0.1 = <%= format("%.2f" , new_score).to_f %></div>
|
||||||
|
<div><%= l(:label_news_score) %> = <%= format("%.2f" , finall_new_score).to_f %></div>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<% issue_count = @project.issues.count %>
|
||||||
|
<% issue_journal_count = @project.issue_changes.count %>
|
||||||
|
<% issue_score = issue_count * 0.2 %>
|
||||||
|
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||||
|
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||||
|
|
||||||
|
<% new_count = @project.news.count %>
|
||||||
|
<% new_score = new_count * 0.1 %>
|
||||||
|
<% finall_new_score = new_score %>
|
||||||
|
|
||||||
|
<% document_count = @project.documents.count %>
|
||||||
|
<% file_score = document_count * 0.1 %>
|
||||||
|
<% finall_file_score = file_score %>
|
||||||
|
|
||||||
|
<% changeset_count = @project.changesets.count %>
|
||||||
|
<% code_submit_score = changeset_count * 0.3 %>
|
||||||
|
<% finall_code_submit_score = code_submit_score %>
|
||||||
|
|
||||||
|
<% board_message_count = 0 %>
|
||||||
|
<% @project.boards.each do |board| %>
|
||||||
|
<% board_message_count += board.messages_count %>
|
||||||
|
<% end %>
|
||||||
|
<% topic_score = board_message_count * 0.1 %>
|
||||||
|
<% finall_topic_score = topic_score %>
|
||||||
|
|
||||||
|
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||||
|
|
||||||
|
<%= l(:label_projects_score) %>
|
||||||
|
<div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> +
|
||||||
|
<%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div>
|
||||||
|
<div> = <%= format("%.2f" , finall_issue_score).to_f %> + <%= format("%.2f" , finall_new_score).to_f %> +
|
||||||
|
<%= format("%.2f" , finall_file_score).to_f %> + <%= format("%.2f" , finall_code_submit_score).to_f %> +
|
||||||
|
<%= format("%.2f" , topic_score).to_f %></div>
|
||||||
|
<div> = <%= format("%.2f" , finall_project_score).to_f %></div>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<% board_message_count = 0 %>
|
||||||
|
<% @project.boards.each do |board| %>
|
||||||
|
<% board_message_count += board.messages_count %>
|
||||||
|
<% end %>
|
||||||
|
<% topic_score = board_message_count * 0.1 %>
|
||||||
|
<% finall_topic_score = topic_score %>
|
||||||
|
<div><%= l(:label_topic_number) %> * 0.1 = <%= board_message_count %> * 0.1 = <%= topic_score %></div>
|
||||||
|
<div><%= l(:label_topic_score) %> = <%= format("%.2f" , finall_topic_score).to_f %></div>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<% issue_count = @project.issues.count %>
|
||||||
|
<% issue_journal_count = @project.issue_changes.count %>
|
||||||
|
<% issue_score = issue_count * 0.2 %>
|
||||||
|
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||||
|
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||||
|
|
||||||
|
<% new_count = @project.news.count %>
|
||||||
|
<% new_score = new_count * 0.1 %>
|
||||||
|
<% finall_new_score = new_score %>
|
||||||
|
|
||||||
|
<% document_count = @project.documents.count %>
|
||||||
|
<% file_score = document_count * 0.1 %>
|
||||||
|
<% finall_file_score = file_score %>
|
||||||
|
|
||||||
|
<% changeset_count = @project.changesets.count %>
|
||||||
|
<% code_submit_score = changeset_count * 0.3 %>
|
||||||
|
<% finall_code_submit_score = code_submit_score %>
|
||||||
|
|
||||||
|
<% board_message_count = 0 %>
|
||||||
|
<% @project.boards.each do |board| %>
|
||||||
|
<% board_message_count += board.messages_count %>
|
||||||
|
<% end %>
|
||||||
|
<% topic_score = board_message_count * 0.1 %>
|
||||||
|
<% finall_topic_score = topic_score %>
|
||||||
|
|
||||||
|
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||||
|
|
||||||
|
<h3 class="title"><%= l(:label_projects_score) %></h3>
|
||||||
|
<div class="inf_user_image">
|
||||||
|
<table style="border-bottom: solid 1px #80a6d2;", width="100%">
|
||||||
|
<tr>
|
||||||
|
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
|
||||||
|
<td>
|
||||||
|
<table>
|
||||||
|
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= @project.name %></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td width="35%">
|
||||||
|
<table>
|
||||||
|
<tr class="info_font"><td><%= l(:label_projects_score) %></td></tr>
|
||||||
|
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , finall_project_score ).to_f %></span></td></tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tabs_new">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_project_score ).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_issue_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_new_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_file_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_code_submit_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
|
||||||
|
<%= format("%.2f" , finall_topic_score).to_f %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="show_score_detail">
|
||||||
|
<%= render :partial => 'projects/project_score_index', :locals => {:index => 0 } %>
|
||||||
|
</div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/show_projects_score') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||||
|
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||||
|
<% activities_count = @user.activities.count %>
|
||||||
|
<% activities_score = activities_count * 0.2 %>
|
||||||
|
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||||
|
<div><%= l(:label_message_number) %> * 0.05 = <%= @user.journals_for_messages.count %> * 0.05 = <%= format("%.2f" , journals_for_messages_score).to_f %></div>
|
||||||
|
<div><%= l(:label_activity_number) %> * 0.2 = <%= @user.activities.count %> * 0.2 = <%= format("%.2f" , activities_score).to_f %></div>
|
||||||
|
<div><%= l(:label_user_score_of_activity) %> = <%= format("%.2f" , journals_for_messages_score).to_f %> + <%= format("%.2f" , activities_score).to_f %>
|
||||||
|
= <%= format("%.2f" , finall_activity_score).to_f %></div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<% 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 %>
|
||||||
|
<div><%= l(:label_comments_number) %> * 0.1 = <%= @user.comments.count %> * 0.1 = <%= format("%.2f" , comments_score).to_f %></div>
|
||||||
|
<div><%= l(:label_news_number) %> * 0.1 = <%= @user.news.count %> * 0.1 = <%= format("%.2f" , news_score).to_f %></div>
|
||||||
|
<div><%= l(:label_wiki_number) %> * 0.1 = <%= @user.wiki_contents.count %> * 0.1 = <%= format("%.2f" , wiki_contents_score).to_f %></div>
|
||||||
|
<div><%= l(:label_user_score_of_influence) %> = <%= format("%.2f" , comments_score).to_f %> + <%= format("%.2f" , news_score).to_f %> +
|
||||||
|
<%= format("%.2f" , wiki_contents_score).to_f %>
|
||||||
|
= <%= format("%.2f" , finall_influence_score).to_f %>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<% 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 %>
|
||||||
|
<div><%= l(:label_issue_message_number) %> * 0.1 = <%= @user.journals.count %> * 0.1 = <%= format("%.2f" , journals_score).to_f %></div>
|
||||||
|
<div><%= l(:label_code_submit_number) %> * 0.3 = <%= @user.changesets.count %> * 0.3 = <%= format("%.2f" , user_changesets_score).to_f %></div>
|
||||||
|
<div><%= l(:label_user_score_of_project) %> = <%= format("%.2f" , journals_score).to_f %> + <%= format("%.2f" , user_changesets_score).to_f %>
|
||||||
|
= <%= format("%.2f" , finall_user_project_score).to_f %>
|
||||||
|
</div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,34 @@
|
||||||
|
<!-- 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_for_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 %>
|
||||||
|
|
||||||
|
<div><%= l(:label_user_score) %></div>
|
||||||
|
<div> = <%= l(:label_user_score_of_topic) %> + <%= l(:label_user_score_of_project) %> +
|
||||||
|
<%= l(:label_user_score_of_activity) %></div>
|
||||||
|
<div> + <%= l(:label_user_score_of_influence) %></div>
|
||||||
|
<div> = <%= format("%.2f" , finall_messages_score).to_f %> + <%= format("%.2f" , finall_user_project_score).to_f %> +
|
||||||
|
<%= format("%.2f" , finall_activity_score).to_f %> + <%= format("%.2f" , finall_influence_score).to_f %></div>
|
||||||
|
<div> = <%= format("%.2f" , finall_user_score).to_f %></div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,75 @@
|
||||||
|
<!-- 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_for_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 %>
|
||||||
|
|
||||||
|
<h3 class="title"><%= l(:label_user_score) %></h3>
|
||||||
|
<div class="inf_user_image">
|
||||||
|
<table style="border-bottom: solid 1px #80a6d2;", width="100%">
|
||||||
|
<tr>
|
||||||
|
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@user), :class => 'avatar2') %></td>
|
||||||
|
<td width="35%">
|
||||||
|
<table>
|
||||||
|
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= h @user.show_name %></td></tr>
|
||||||
|
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= @user.user_extensions.show_identity %></td></tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table>
|
||||||
|
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
|
||||||
|
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , finall_user_score).to_f %></span></td></tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tabs_new">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_user_score), {:controller => 'users', :action => 'score_index', :remote => true} %> :
|
||||||
|
<%= format("%.2f" , finall_user_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_user_score_of_topic), {:controller => 'users', :action => 'topic_score_index', :remote => true} %> :
|
||||||
|
<%= format("%.2f" , finall_messages_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_user_score_of_project), {:controller => 'users', :action => 'project_score_index', :remote => true} %> :
|
||||||
|
<%= format("%.2f" , finall_user_project_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_user_score_of_activity), {:controller => 'users', :action => 'activity_score_index', :remote => true} %> :
|
||||||
|
<%= format("%.2f" , finall_activity_score).to_f %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_user_score_of_influence), {:controller => 'users', :action => 'influence_score_index', :remote => true} %> :
|
||||||
|
<%= format("%.2f" , finall_influence_score).to_f %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="show_score_detail">
|
||||||
|
<%= render :partial => 'users/score_index', :locals => {:index => 0 } %>
|
||||||
|
</div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!-- added by bai -->
|
||||||
|
<!-- <div>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<%= l(:label_question_top) %> :
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= l(:label_question_down) %> :
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= l(:label_answer_top) %> :
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= l(:label_answer_down) %> :
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<% messages_count = @user.messages.count %>
|
||||||
|
<% messages_score = messages_count * 0.05%>
|
||||||
|
<div><%= l(:label_topic_number) %> * 0.05 = <%= @user.messages.count %> * 0.05 = <%= format("%.2f" , messages_score).to_f %></div>
|
||||||
|
<div><%= l(:label_user_score_of_topic) %> = <%= format("%.2f" , messages_score).to_f %></div>
|
||||||
|
<!-- end -->
|
|
@ -0,0 +1 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_score_index', :locals => {:index =>0 }) %>');
|
|
@ -0,0 +1 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_score_index', :locals => {:index =>0 }) %>');
|
|
@ -0,0 +1 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_score_index', :locals => {:index =>1 }) %>');
|
|
@ -0,0 +1 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/score_index', :locals => {:index =>0 }) %>');
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_score') %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1 @@
|
||||||
|
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/topic_score_index', :locals => {:index =>0 }) %>');
|
|
@ -1594,7 +1594,36 @@ zh:
|
||||||
label_endup_time: 结课时间
|
label_endup_time: 结课时间
|
||||||
label_class_period: 整体课时
|
label_class_period: 整体课时
|
||||||
label_class_hour: 学时
|
label_class_hour: 学时
|
||||||
|
label_user_score: 个人综合得分
|
||||||
|
label_user_score_of_topic: 帖子得分
|
||||||
|
label_user_score_of_project: 项目得分
|
||||||
|
label_user_score_of_activity: 活跃度得分
|
||||||
|
label_user_score_of_influence: 影响力得分
|
||||||
|
label_question_top: 问题被顶次数
|
||||||
|
label_question_down: 问题被踩次数
|
||||||
|
label_answer_top: 回答被顶次数
|
||||||
|
label_answer_down: 回答被踩次数
|
||||||
|
label_comments_number: 评论的数量
|
||||||
|
label_news_number: 新闻的数量
|
||||||
|
label_wiki_number: wiki的数量
|
||||||
|
label_message_number: 留言的数量
|
||||||
|
label_activity_number: 个人动态数量
|
||||||
|
label_issue_message_number: 对issue的留言数量
|
||||||
|
label_code_submit_number: 代码提交次数
|
||||||
|
label_topic_number: 讨论区发言数量
|
||||||
|
label_projects_score: 项目综合得分
|
||||||
|
label_issue_score: issue得分
|
||||||
|
label_news_score: 新闻得分
|
||||||
|
label_file_score: 文档得分
|
||||||
|
label_code_submit_score: 代码提交得分
|
||||||
|
label_topic_score: 讨论区得分
|
||||||
|
label_issue_number: issue的数量
|
||||||
|
label_issue_journal_number: issue的留言数量
|
||||||
|
label_new_number: 新闻的数量
|
||||||
|
label_file_number: 文档的数量
|
||||||
|
label_code_submit_number: 代码提交数量
|
||||||
|
label_topic_number: 讨论区帖子数量
|
||||||
|
|
||||||
label_course_contribute_to: 参与了 %{project_count} 个项目:
|
label_course_contribute_to: 参与了 %{project_count} 个项目:
|
||||||
label_x_course_contribute_to:
|
label_x_course_contribute_to:
|
||||||
zero: "参与了 %{count} 个课程:"
|
zero: "参与了 %{count} 个课程:"
|
||||||
|
|
|
@ -113,7 +113,21 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'user_courses', :to => 'users#user_courses', :via => :get
|
match 'user_courses', :to => 'users#user_courses', :via => :get
|
||||||
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
|
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
|
||||||
match 'watch_projects', :to => 'users#watch_projects', :via => :get
|
match 'watch_projects', :to => 'users#watch_projects', :via => :get
|
||||||
|
# added by bai
|
||||||
match 'show_score', :to => 'users#show_score', :via => :get
|
match 'show_score', :to => 'users#show_score', :via => :get
|
||||||
|
match 'topic_score_index', :controller => 'users', :action => 'topic_score_index', :via => [:get, :post]
|
||||||
|
match 'project_score_index', :to => 'users#project_score_index', :via => :get
|
||||||
|
match 'activity_score_index', :to => 'users#activity_score_index', :via => :get
|
||||||
|
match 'influence_score_index', :to => 'users#influence_score_index', :via => :get
|
||||||
|
match 'score_index', :to => 'users#score_index', :via => :get
|
||||||
|
|
||||||
|
match 'show_projects_score', :to => 'projects#show_projects_score', :via => [:get, :post]
|
||||||
|
match 'issue_score_index', :to => 'projects#issue_score_index', :via => [:get, :post]
|
||||||
|
match 'news_score_index', :to => 'projects#news_score_index', :via => [:get, :post]
|
||||||
|
match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post]
|
||||||
|
match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post]
|
||||||
|
match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post]
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
||||||
|
|
|
@ -379,6 +379,15 @@ span.forums-avatar-right{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*added by bai*/
|
/*added by bai*/
|
||||||
|
.user_underlinescore{
|
||||||
|
margin:1;
|
||||||
|
padding:1;
|
||||||
|
width:700px;
|
||||||
|
height:1px;
|
||||||
|
background-color:#15bccf;
|
||||||
|
overflow:hidden
|
||||||
|
}
|
||||||
|
|
||||||
.top-course-content{
|
.top-course-content{
|
||||||
background-color: rgb(181,227, 251);
|
background-color: rgb(181,227, 251);
|
||||||
height: 45px;
|
height: 45px;
|
||||||
|
@ -828,6 +837,8 @@ ul.tool li{list-style-type:none;
|
||||||
overflow:hidden
|
overflow:hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.user_enterprise_underline{
|
.user_enterprise_underline{
|
||||||
margin:1;
|
margin:1;
|
||||||
padding:1;
|
padding:1;
|
||||||
|
|
|
@ -1993,7 +1993,24 @@ div.avatar_user{
|
||||||
padding:5px 10px 6px 7px; /* Links */
|
padding:5px 10px 6px 7px; /* Links */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttons_for_score a {
|
||||||
|
display:block;
|
||||||
|
float:left;
|
||||||
|
margin:0 7px 0 0;
|
||||||
|
background-color: #ec6300;
|
||||||
|
border:1px solid #dedede;
|
||||||
|
border-top:1px solid #eee;
|
||||||
|
border-left:1px solid #eee;
|
||||||
|
|
||||||
|
font-family:"微软雅黑", sans-serif;
|
||||||
|
font-size:12px;
|
||||||
|
line-height:130%;
|
||||||
|
text-decoration:none;
|
||||||
|
font-weight:bold;
|
||||||
|
color:#565656;
|
||||||
|
cursor:pointer;
|
||||||
|
padding:5px 10px 6px 7px; /* Links */
|
||||||
|
}
|
||||||
/* STANDARD */
|
/* STANDARD */
|
||||||
|
|
||||||
.buttons_for_course a:hover{
|
.buttons_for_course a:hover{
|
||||||
|
|
Loading…
Reference in New Issue