项目文档得分计算错误问题

This commit is contained in:
z9hang 2014-08-16 16:28:35 +08:00
parent c77a1fc2ef
commit 378c06379e
2 changed files with 5 additions and 5 deletions

View File

@ -279,7 +279,7 @@ class ApplicationController < ActionController::Base
# Find project of id params[:id] # Find project of id params[:id]
def find_project def find_project
@project = Project.find(params[:id]) @project = Project.find_by_id(params[:id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end

View File

@ -16,7 +16,7 @@ module ProjectScoreHelper
end end
#文档数量 #文档数量
def document_num project def documents_num project
project.documents.count project.documents.count
end end
@ -48,8 +48,8 @@ module ProjectScoreHelper
end end
#文档得分 #文档得分
def document_score project def documents_score project
d_num = document_num project d_num = documents_num(project)
d_num * 4 d_num * 4
end end
@ -67,7 +67,7 @@ module ProjectScoreHelper
#计算项目得分 #计算项目得分
def project_scores project def project_scores project
result = (issue_score project) + (news_score project) + (document_score project) + (changesets_score project) + (board_message_score project) result = (issue_score project) + (news_score project) + (documents_score project) + (changesets_score project) + (board_message_score project)
pss = ProjectScore.where("project_id = '#{project.id}'") pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0 if pss.nil? || pss.count == 0
ps = ProjectScore.new ps = ProjectScore.new