主页项目得分与项目页面的项目得分保持一致
This commit is contained in:
parent
cc2862ae0f
commit
54a2fb8a9c
|
@ -235,6 +235,7 @@ module WelcomeHelper
|
||||||
def show_grade project
|
def show_grade project
|
||||||
grade = 0
|
grade = 0
|
||||||
begin
|
begin
|
||||||
|
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")#执行存储过程速度慢
|
||||||
grade = project.project_status.grade if project && project.project_status
|
grade = project.project_status.grade if project && project.project_status
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
|
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
|
||||||
|
|
|
@ -68,7 +68,33 @@
|
||||||
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
|
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
|
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
|
||||||
<%= content_tag "span", show_grade(project),
|
<% 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)+ ":" + format("%.2f" , finall_project_score ),
|
||||||
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
|
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
|
||||||
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
||||||
:class => "tooltip",
|
:class => "tooltip",
|
||||||
|
|
|
@ -500,6 +500,7 @@ zh:
|
||||||
label_project_new: 新建项目
|
label_project_new: 新建项目
|
||||||
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
||||||
label_project_plural: 项目列表
|
label_project_plural: 项目列表
|
||||||
|
label_project_score: 项目评分
|
||||||
label_x_projects:
|
label_x_projects:
|
||||||
zero: 无项目
|
zero: 无项目
|
||||||
one: 1 个项目
|
one: 1 个项目
|
||||||
|
|
Loading…
Reference in New Issue