|
|
|
@ -7,11 +7,9 @@ namespace :subjects do
|
|
|
|
|
subjects = Subject.where(status: 2, hidden: 0)
|
|
|
|
|
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
|
|
|
|
|
"school_used_count, created_at, updated_at"
|
|
|
|
|
buffer_size = 0
|
|
|
|
|
str = []
|
|
|
|
|
subjects.find_in_batches(batch_size: 50) do |s|
|
|
|
|
|
str = []
|
|
|
|
|
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
|
|
|
|
|
buffer_size += 1
|
|
|
|
|
puts("---------------------data_statistic: #{subject.id}")
|
|
|
|
|
Rails.logger.info("---------------------data_statistic: #{subject.id}")
|
|
|
|
|
data = Subjects::DataStatisticService.new(subject)
|
|
|
|
@ -29,7 +27,6 @@ namespace :subjects do
|
|
|
|
|
puts sql
|
|
|
|
|
ActiveRecord::Base.connection.execute sql
|
|
|
|
|
str = []
|
|
|
|
|
buffer_size = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|