修复由项目积分改动引起的一个页面无法查看bug、添加项目得分统计任务

This commit is contained in:
z9hang 2014-08-06 16:02:26 +08:00
parent 0eca547ec5
commit c6271e2aa9
3 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -74,6 +74,7 @@ module ProjectScoreHelper
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

View File

@ -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