From 57c64784f049c3cecaac0b244fc49898a262af2a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 21 Sep 2019 19:44:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/create_subject_course_student_job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/jobs/create_subject_course_student_job.rb b/app/jobs/create_subject_course_student_job.rb index 38ff83024..a7b8cb8af 100644 --- a/app/jobs/create_subject_course_student_job.rb +++ b/app/jobs/create_subject_course_student_job.rb @@ -8,13 +8,15 @@ class CreateSubjectCourseStudentJob < ApplicationJob attrs = %i[course_id user_id role created_at updated_at] same_attrs = {course_id: course.id, role: 4} + Rails.logger.info("1:course.students.count:##{course.students.count}") CourseMember.bulk_insert(*attrs) do |worker| course.subject.subject_appointments.each do |app| + Rails.logger.info("##{course.students.where(user_id: app.user_id)}") next if course.students.where(user_id: app.user_id).any? worker.add same_attrs.merge(user_id: app.user_id) end end - + Rails.logger.info("2:course.students.count:##{course.students.count}") course.subject.subject_appointments.destroy_all end end