Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
34af8053cc
|
@ -70,3 +70,8 @@ kw:
|
|||
undefined image_width ÎÊÌâ
|
||||
bundle exec rake db:migrate:down version=20140725062302
|
||||
bundle exec rake db:migrate:up version=20140725062302
|
||||
|
||||
=================================[2014-07-19]=====================================
|
||||
kw: Mysql2::Error,存储过程,CALL sp_project_status_cursor();
|
||||
bundle exec rake db:migrate:down version=20130828004955
|
||||
bundle exec rake db:migrate:up version=20130828004955
|
||||
|
|
|
@ -20,7 +20,7 @@ class ActivitiesController < ApplicationController
|
|||
before_filter :find_optional_project, :index
|
||||
accept_rss_auth :index
|
||||
helper :Watchers
|
||||
|
||||
helper :project_score
|
||||
def index
|
||||
@days = Setting.activity_days_default.to_i
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class BoardsController < ApplicationController
|
|||
helper :sort
|
||||
include SortHelper
|
||||
helper :watchers
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
#modify by nwb
|
||||
|
|
|
@ -27,6 +27,7 @@ class CalendarsController < ApplicationController
|
|||
include QueriesHelper
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :project_score
|
||||
|
||||
def show
|
||||
if params[:year] and params[:year].to_i > 1900
|
||||
|
|
|
@ -26,6 +26,7 @@ class DocumentsController < ApplicationController
|
|||
before_filter :authorize_document
|
||||
|
||||
helper :attachments
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
||||
|
|
|
@ -24,6 +24,7 @@ class FilesController < ApplicationController
|
|||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
#sort_init 'filename', 'asc'
|
||||
|
|
|
@ -29,6 +29,7 @@ class GanttsController < ApplicationController
|
|||
helper :sort
|
||||
include SortHelper
|
||||
include Redmine::Export::PDF
|
||||
helper :project_score
|
||||
|
||||
def show
|
||||
@gantt = Redmine::Helpers::Gantt.new(params)
|
||||
|
|
|
@ -26,6 +26,8 @@ class IssueCategoriesController < ApplicationController
|
|||
before_filter :authorize
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_settings_in_projects }
|
||||
|
|
|
@ -52,6 +52,7 @@ class IssuesController < ApplicationController
|
|||
include IssuesHelper
|
||||
helper :timelog
|
||||
include Redmine::Export::PDF
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
retrieve_query
|
||||
|
|
|
@ -28,6 +28,7 @@ class MessagesController < ApplicationController
|
|||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :project_score
|
||||
|
||||
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ class NewsController < ApplicationController
|
|||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
case params[:format]
|
||||
|
|
|
@ -75,6 +75,7 @@ class ProjectsController < ApplicationController
|
|||
helper :watchers
|
||||
# helper :watcherlist
|
||||
helper :words
|
||||
helper :project_score
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
|
@ -493,10 +494,10 @@ class ProjectsController < ApplicationController
|
|||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
if params[:project][:is_public] == '1'
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type)
|
||||
#if params[:project][:is_public] == '1'
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0)
|
||||
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
|
||||
end
|
||||
#end
|
||||
@project.members << m
|
||||
@project.project_infos << project_info
|
||||
#end
|
||||
|
|
|
@ -39,6 +39,7 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
||||
helper :repositories
|
||||
include RepositoriesHelper
|
||||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
|
||||
|
||||
|
@ -205,6 +206,14 @@ class RepositoriesController < ApplicationController
|
|||
@repository.committer_ids = params[:committers].values.inject({}) {|h, c| h[c.first] = c.last; h}
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
elsif request.get?
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
render :layout => "project_base"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -412,7 +421,10 @@ class RepositoriesController < ApplicationController
|
|||
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
|
||||
unless read_fragment(@cache_key)
|
||||
@diff = @repository.diff(@path, @rev, @rev_to)
|
||||
show_error_not_found unless @diff
|
||||
unless @diff
|
||||
show_error_not_found
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
|
|
|
@ -29,6 +29,7 @@ class VersionsController < ApplicationController
|
|||
|
||||
helper :custom_fields
|
||||
helper :projects
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
class WelcomeController < ApplicationController
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
|
||||
helper :project_score
|
||||
caches_action :robots
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
|
|
|
@ -44,6 +44,7 @@ class WikiController < ApplicationController
|
|||
include AttachmentsHelper
|
||||
helper :watchers
|
||||
include Redmine::Export::PDF
|
||||
helper :project_score
|
||||
|
||||
# List of pages, sorted alphabetically and by parent (hierarchy)
|
||||
def index
|
||||
|
|
|
@ -1,8 +1,90 @@
|
|||
# encoding: utf-8
|
||||
class ProjectScoreHelper
|
||||
module ProjectScoreHelper
|
||||
#缺陷数量
|
||||
def issue_num project
|
||||
project.issues.count
|
||||
end
|
||||
|
||||
#缺陷留言数量
|
||||
def issue_journal_num project
|
||||
project.issue_changes.count
|
||||
end
|
||||
|
||||
#新闻数量
|
||||
def news_num project
|
||||
project.news.count
|
||||
end
|
||||
|
||||
#文档数量
|
||||
def document_num project
|
||||
project.documents.count
|
||||
end
|
||||
|
||||
#代码提交数量
|
||||
def changesets_num project
|
||||
project.changesets.count
|
||||
end
|
||||
|
||||
#讨论区帖子数量
|
||||
def board_message_num project
|
||||
board_message_count = 0
|
||||
project.boards.each do |board|
|
||||
board_message_count += board.messages_count
|
||||
end
|
||||
board_message_count
|
||||
end
|
||||
|
||||
#缺陷得分
|
||||
def issue_score project
|
||||
i_num = issue_num project
|
||||
i_j_num = issue_journal_num project
|
||||
i_num * 4 + i_j_num
|
||||
end
|
||||
|
||||
# 新闻得分
|
||||
def news_score project
|
||||
n_num = news_num project
|
||||
n_num
|
||||
end
|
||||
|
||||
#文档得分
|
||||
def document_score project
|
||||
d_num = document_num project
|
||||
d_num * 4
|
||||
end
|
||||
|
||||
#代码提交得分
|
||||
def changesets_score project
|
||||
c_num = changesets_num project
|
||||
c_num * 4
|
||||
end
|
||||
|
||||
#讨论区帖子得分
|
||||
def board_message_score project
|
||||
b_m_num = board_message_num project
|
||||
b_m_num * 2
|
||||
end
|
||||
|
||||
#项目得分
|
||||
def project_scores project
|
||||
result = (issue_score project) + (news_score project) + (document_score project) + (changesets_score project) + (board_message_score project)
|
||||
pss = ProjectStatus.where("project_id = '#{project.id}'")
|
||||
if pss.nil? || pss.count == 0
|
||||
ps = ProjectStatus.new
|
||||
ps.grade = result
|
||||
ps.project = project
|
||||
ps.watchers_count = project.watcher_users.count
|
||||
ps.changesets_count = project.changesets.count
|
||||
ps.save
|
||||
else
|
||||
ps = pss.first
|
||||
ps.grade = result
|
||||
if ps.changesets_count.nil? || ps.changesets_count == ""
|
||||
ps.changesets_count = project.changesets.count
|
||||
end
|
||||
ps.save
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
end
|
|
@ -337,12 +337,15 @@ module UserScoreHelper
|
|||
:activity => activity, :file => file, :issue => issue, :level => level)
|
||||
end
|
||||
|
||||
#====================================================================================================
|
||||
def get_option_number(user,type,project_id=nil)
|
||||
if project_id.nil?
|
||||
#========================================================================================================
|
||||
#个人得分统计
|
||||
#========================================================================================================
|
||||
#type 1:个人得分、2:个人在项目project中的得分
|
||||
def get_option_number(user,type,project=nil)
|
||||
if project.nil?
|
||||
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
|
||||
else
|
||||
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project_id}'");
|
||||
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project.id}'");
|
||||
end
|
||||
|
||||
result = nil
|
||||
|
@ -402,9 +405,9 @@ module UserScoreHelper
|
|||
end
|
||||
|
||||
#更新发帖数
|
||||
def update_memo_number(user,type)
|
||||
option_number = get_option_number(user,type)
|
||||
option_number.memo = Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
|
||||
def update_memo_number(user,type,project=nil)
|
||||
option_number = get_option_number(user,type,project)
|
||||
option_number.memo = memo_num(user,project)#Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
|
||||
update_score(option_number)
|
||||
end
|
||||
|
||||
|
@ -419,9 +422,9 @@ module UserScoreHelper
|
|||
end
|
||||
|
||||
#更新对缺陷留言数
|
||||
def update_messges_for_issue(user,type)
|
||||
def update_messges_for_issue(user,type,project=nil)
|
||||
option_number = get_option_number(user,type)
|
||||
option_number.messages_for_issues = Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
|
||||
option_number.messages_for_issues = messges_for_issue_num(user,project)#Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
|
||||
update_score(option_number)
|
||||
end
|
||||
|
||||
|
@ -434,9 +437,9 @@ module UserScoreHelper
|
|||
end
|
||||
|
||||
#更新更改缺陷状态状态次数
|
||||
def update_issues_status(user,type)
|
||||
def update_issues_status(user,type,project=nil)
|
||||
option_number = get_option_number(user,type)
|
||||
option_number.issues_status = Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
|
||||
option_number.issues_status = issues_status_num(user,project)#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
|
||||
update_score(option_number)
|
||||
end
|
||||
|
||||
|
@ -450,14 +453,19 @@ module UserScoreHelper
|
|||
end
|
||||
|
||||
#更新对留言的回复数量
|
||||
def update_replay_for_message(user,type)
|
||||
def update_replay_for_message(user,type,project=nil)
|
||||
option_number = get_option_number(user,type)
|
||||
option_number.replay_for_message = JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
|
||||
option_number.replay_for_message = replay_for_message_num(user,project)#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
|
||||
update_score(option_number)
|
||||
end
|
||||
|
||||
def replay_for_message_num(user)
|
||||
#====================================contiue here=====================================================
|
||||
def replay_for_message_num(user,project=nil)
|
||||
if project.nil?
|
||||
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#更新对帖子的回复数量
|
||||
|
@ -727,6 +735,9 @@ module UserScoreHelper
|
|||
else
|
||||
Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
|
||||
end
|
||||
end
|
||||
|
||||
def user_scores(user,type)
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -193,7 +193,7 @@ class Attachment < ActiveRecord::Base
|
|||
def show_suffix_type
|
||||
suffix = 'other'
|
||||
temp = self.suffix_type.downcase
|
||||
if self.attachmentstype.suffixArr.include?(temp)
|
||||
if self.attachmentstype && self.attachmentstype.suffixArr.include?(temp)
|
||||
suffix = temp
|
||||
end
|
||||
suffix
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ProjectStatus < ActiveRecord::Base
|
||||
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type
|
||||
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type,:grade
|
||||
belongs_to :project
|
||||
belongs_to :watchers
|
||||
belongs_to :changesets
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<td>
|
||||
<strong>项目得分:
|
||||
<span style="color: <%= homework.project.nil? ? "#727272" : "#EC6300"%>;">
|
||||
<%= homework.project.nil? ? "N/A" : project_score(homework.project) %>
|
||||
<%= homework.project.nil? ? "N/A" : project_scores(homework.project) %>
|
||||
</span>
|
||||
</strong>
|
||||
</td>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="attach_type">
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName unless file.attachmentstype.nil? %></span>
|
||||
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %>
|
||||
</span>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<% #@nav_dispaly_project_label = 1 %>
|
||||
|
@ -62,37 +63,10 @@
|
|||
<%= link_to @project.name, project_path(@project)%>
|
||||
</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 %>
|
||||
<%= l(:label_project_grade)%> :
|
||||
<%= link_to(format("%.2f" , finall_project_score ).to_f, {:controller => 'projects',
|
||||
<%= link_to(format("%.2f" , project_scores(@project) ).to_i, {:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<!-- added by bai -->
|
||||
<% 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>
|
||||
<div><%= l(:label_code_submit_number) %> * 4 = <%= changesets_num(@project) %> * 4 = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
|
||||
<div><%= l(:label_code_submit_score) %> = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -1,7 +1,4 @@
|
|||
<!-- added by bai -->
|
||||
<% 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>
|
||||
<div><%= l(:label_file_number) %> * 4 = <%= document_num(@project) %> * 4 = <%= format("%.2f" , document_score(@project)).to_i %></div>
|
||||
<div><%= l(:label_file_score) %> = <%= format("%.2f" , document_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -1,11 +1,6 @@
|
|||
<!-- 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>
|
||||
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(@project) %> * 4 = <%= format("%.2f" , issue_num(@project) * 4).to_i %></div>
|
||||
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(@project) %> * 1 = <%= format("%.2f" , issue_journal_num(@project)).to_i %></div>
|
||||
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(@project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(@project)).to_i %>
|
||||
= <%= format("%.2f" , issue_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -1,7 +1,5 @@
|
|||
<!-- added by bai -->
|
||||
<% 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>
|
||||
|
||||
<div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div>
|
||||
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -18,37 +18,37 @@
|
|||
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<table style="width: 400px;">
|
||||
<table style="width: 280px;">
|
||||
<tr>
|
||||
<td style="width: 50%;text-align: right;font-size: 17px;">
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;">
|
||||
<strong><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></strong>
|
||||
</td>
|
||||
<td style="width: 50%;text-align: left">
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%;text-align: right;font-size: 17px;">
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;">
|
||||
<strong><%= link_to "#{@project.members.count}", project_member_path(@project)%></strong>
|
||||
</td>
|
||||
<td style="width: 50%;text-align: left">
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<strong><%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %></strong>
|
||||
</td>
|
||||
<td style="width: 50%;text-align: left">
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_since_last_commits)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<% #find_project_repository @project %>
|
||||
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong>
|
||||
</td>
|
||||
<td style="width: 50%;text-align: left">
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_commit_on)) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -124,37 +124,11 @@
|
|||
|
||||
<!-- added by bai -->
|
||||
<div class="grade">
|
||||
<% 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 !=1 %>
|
||||
<%= l(:label_project_grade)%>:
|
||||
<span >
|
||||
<%= link_to(format("%.2f" , finall_project_score ).to_f,
|
||||
<%= link_to(format("%.2f" , project_scores(@project) ).to_i,
|
||||
{:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
<!-- 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 %>
|
||||
|
||||
<%= 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>
|
||||
<div> = <%= format("%.2f" , issue_score(@project)).to_i %> + <%= format("%.2f" , news_score(@project)).to_i %> +
|
||||
<%= format("%.2f" , document_score(@project)).to_i %> + <%= format("%.2f" , changesets_score(@project)).to_i %> +
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %></div>
|
||||
<div> = <%= format("%.2f" , project_scores(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -1,10 +1,4 @@
|
|||
<!-- added by bai -->
|
||||
<% 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>
|
||||
<div><%= l(:label_topic_number) %> * 2 = <%= board_message_num(@project) %> * 2 = <%= board_message_score(@project) %></div>
|
||||
<div><%= l(:label_topic_score) %> = <%= format("%.2f" , board_message_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
|
@ -1,30 +1,4 @@
|
|||
<!-- 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">
|
||||
|
@ -40,7 +14,7 @@
|
|||
<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>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -51,27 +25,27 @@
|
|||
<ul>
|
||||
<li>
|
||||
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_project_score ).to_f %>
|
||||
<%= format("%.2f" , project_scores(@project) ).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_issue_score).to_f %>
|
||||
<%= format("%.2f" , issue_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_new_score).to_f %>
|
||||
<%= format("%.2f" , news_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_file_score).to_f %>
|
||||
<%= format("%.2f" , document_score(@project)).to_i %>
|
||||
</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 %>
|
||||
<%= format("%.2f" , changesets_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_topic_score).to_f %>
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
<!-- 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 %>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
|
@ -56,7 +31,7 @@
|
|||
<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>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -67,27 +42,27 @@
|
|||
<ul>
|
||||
<li>
|
||||
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_project_score ).to_f %>
|
||||
<%= format("%.2f" , project_scores(@project) ).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_issue_score).to_f %>
|
||||
<%= format("%.2f" , issue_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_new_score).to_f %>
|
||||
<%= format("%.2f" , news_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_file_score).to_f %>
|
||||
<%= format("%.2f" , document_score(@project)).to_i %>
|
||||
</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 %>
|
||||
<%= format("%.2f" , changesets_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , finall_topic_score).to_f %>
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -79,33 +79,7 @@
|
|||
<span class='font_lighter' title ='<%=project.short_description%>'><%=project.description.truncate(100, omission: '...')%></span>
|
||||
</div>
|
||||
<div >
|
||||
<%# 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 %>
|
||||
<%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
|
||||
<%= content_tag "span", l(:label_project_score)+ ":" + project_scores(project).to_s,
|
||||
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
|
||||
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
||||
:class => "tooltip",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# -*coding:utf-8 -*-
|
||||
desc "project score Initialize"
|
||||
task :project_score do
|
||||
puts "project_score sync."
|
||||
end
|
||||
|
||||
namespace :project_score do
|
||||
desc "calculating first page"
|
||||
task :calculate => :environment do
|
||||
include ProjectScoreHelper
|
||||
Project.where("project_type != 1").all.each do |project|
|
||||
result = project_scores(project)
|
||||
puts "score of #{project.name} is #{result}"
|
||||
end
|
||||
puts "calculate completed"
|
||||
end
|
||||
end
|
|
@ -16,6 +16,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CodeReviewController < ApplicationController
|
||||
layout "project_base"
|
||||
unloadable
|
||||
before_filter :find_project, :authorize, :find_user, :find_setting, :find_repository
|
||||
|
||||
|
|
|
@ -1070,10 +1070,10 @@ overflow: hidden;
|
|||
|
||||
.information {
|
||||
margin-top: 20px;
|
||||
margin-left: 607px;
|
||||
margin-left: 690px;
|
||||
float: left;
|
||||
height: auto;
|
||||
width: 300px;
|
||||
width: 280px;
|
||||
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
|
||||
color: rgb(0, 0, 0);
|
||||
font-size: 13px;
|
||||
|
@ -1232,7 +1232,7 @@ p.stats {
|
|||
.licences {
|
||||
float: left;
|
||||
height: 18px;
|
||||
width: 260px;
|
||||
width: 200px;
|
||||
font-size: 13px;
|
||||
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
|
||||
line-height: 18px;
|
||||
|
|
Loading…
Reference in New Issue