From 452a38117ada80868d5999b36cb79df5fe34ba0e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sun, 8 Mar 2020 11:03:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_evaluate.rake | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/tasks/sync_evaluate.rake b/lib/tasks/sync_evaluate.rake index 14d6d7acc..bb54f9565 100644 --- a/lib/tasks/sync_evaluate.rake +++ b/lib/tasks/sync_evaluate.rake @@ -2,13 +2,8 @@ desc "同步学院或者单位评测数" namespace :sync_evaluate do task outpus_count: :environment do - if ENV['school_id'].present? - schools = School.where(id: ENV['school_id'].to_i) - else - schools = School.all - end - schools.find_each do |s| - #Parallel.each_with_index(school, in_processes: 5) do |s| + schools.find_each do |school| + Parallel.each_with_index(school, in_processes: 5) do |s| puts "school_id:#{s.id}" evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where g.user_id = ue.user_id and ue.school_id = '#{s.id}'").first.try(:e_count) @@ -19,7 +14,7 @@ namespace :sync_evaluate do report.shixun_evaluate_count = evaluate_count report.save - #end + end end end end \ No newline at end of file