|
|
@ -46,7 +46,7 @@ namespace :subjects do
|
|
|
|
if ENV['subject_id'].present?
|
|
|
|
if ENV['subject_id'].present?
|
|
|
|
subjects = subjects.where(id:ENV['subject_id'])
|
|
|
|
subjects = subjects.where(id:ENV['subject_id'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
subjects.find_in_batches(batch_size: 50) do |s|
|
|
|
|
subjects.find_in_batches(batch_size: 20) do |s|
|
|
|
|
str = []
|
|
|
|
str = []
|
|
|
|
Parallel.each(s, in_processes: 6) do |subject|
|
|
|
|
Parallel.each(s, in_processes: 6) do |subject|
|
|
|
|
puts("---------------------course_info_statistic: #{subject.id}")
|
|
|
|
puts("---------------------course_info_statistic: #{subject.id}")
|
|
|
@ -85,7 +85,7 @@ namespace :subjects do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
|
|
|
|
column_value = "subject_id, shixun_id, stage, shixun_name, challenge_count, course_count, " +
|
|
|
|
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
|
|
|
|
"school_count, used_count, passed_count, evaluate_count, passed_ave_time, created_at, updated_at"
|
|
|
|
subjects.find_in_batches(batch_size: 50) do |s|
|
|
|
|
subjects.find_in_batches(batch_size: 20) do |s|
|
|
|
|
Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
|
|
|
|
Parallel.each_with_index(s, in_processes: 4) do |subject, index, str = []|
|
|
|
|
puts("---------------------shixun_info_statistic: #{subject.id}")
|
|
|
|
puts("---------------------shixun_info_statistic: #{subject.id}")
|
|
|
|
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
|
|
|
|
Rails.logger.info("---------------------shixun_info_statistic: #{subject.id}")
|
|
|
|