desc "User New Score description" task :user_new_score do puts "user_score sync." end namespace :user_new_score do desc "calculating user score" task :calculating => :environment do include UserScoreHelper User.all.each do |user| result = user_scores(user,1).total_score puts "score of #{user.login} is #{result}" end Project.where("project_type != 1").all.each do |project| project.member_principals.includes(:roles, :principal).all.each do |member| result = user_scores(member.user,2,project).total_score puts "#{user.login}/'s score in #{project.name} is #{result}" end end puts "calculate completed" end end