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
