diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 35fd6ee0..048933e4 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -235,6 +235,7 @@ module WelcomeHelper def show_grade project grade = 0 begin + #ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")#执行存储过程速度慢 grade = project.project_status.grade if project && project.project_status rescue Exception => e logger.error "Logger.Error [WelcomeHelper] ===> #{e}" diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 16a4cbf2..345f4773 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -68,7 +68,33 @@ ><%=project.description.truncate(50, omission: '...')%>
- <%= 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; ", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :class => "tooltip", diff --git a/config/locales/zh.yml b/config/locales/zh.yml index eacd5ac4..9b622531 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -500,6 +500,7 @@ zh: label_project_new: 新建项目 label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' label_project_plural: 项目列表 + label_project_score: 项目评分 label_x_projects: zero: 无项目 one: 1 个项目