You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psfpeqmhf/db/migrate/20200331024234_migrate_stud...

28 lines
1.2 KiB

class MigrateStudentWorkReviewed < ActiveRecord::Migration[5.2]
def change
# practical_homeworks = HomeworkCommon.where("homework_type = 4 and publish_time < '#{Time.current}'")
# practical_homeworks.includes(score_student_works: [:shixun_work_comments, :student_works_scores, :challenge_work_scores]).find_in_batches(batch_size: 50) do |p|
# Parallel.each(p, in_threads: 4) do |homework|
# homework.score_student_works.each do |work|
# if work.shixun_has_comment?
# work.update_column("reviewed", 1)
# end
# end
# puts "practical_homework_id: #{homework.id}"
# end
# end
#
# other_homeworks = HomeworkCommon.where("homework_type in (1, 3) and publish_time < '#{Time.current}'")
# other_homeworks.includes(score_student_works: [:shixun_work_comments, :student_works_scores, :challenge_work_scores]).find_in_batches(batch_size: 50) do |p|
# Parallel.each(p, in_threads: 4) do |homework|
# homework.score_student_works.each do |work|
# if work.work_has_comment?
# work.update_column("reviewed", 1)
# end
# end
# puts "other_homework_id: #{homework.id}"
# end
# end
end
end