项目文档得分计算错误问题
This commit is contained in:
parent
c77a1fc2ef
commit
378c06379e
|
@ -279,7 +279,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# Find project of id params[:id]
|
||||
def find_project
|
||||
@project = Project.find(params[:id])
|
||||
@project = Project.find_by_id(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module ProjectScoreHelper
|
|||
end
|
||||
|
||||
#文档数量
|
||||
def document_num project
|
||||
def documents_num project
|
||||
project.documents.count
|
||||
end
|
||||
|
||||
|
@ -48,8 +48,8 @@ module ProjectScoreHelper
|
|||
end
|
||||
|
||||
#文档得分
|
||||
def document_score project
|
||||
d_num = document_num project
|
||||
def documents_score project
|
||||
d_num = documents_num(project)
|
||||
d_num * 4
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ module ProjectScoreHelper
|
|||
|
||||
#计算项目得分
|
||||
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}'")
|
||||
if pss.nil? || pss.count == 0
|
||||
ps = ProjectScore.new
|
||||
|
|
Loading…
Reference in New Issue