|
|
@ -25,7 +25,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework|
|
|
|
|
course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework|
|
|
|
|
next if homework.student_works.where(user_id: user_id).any?
|
|
|
|
next if StudentWork.where(user_id: user_id, homework_common_id: homework.id).any?
|
|
|
|
worker.add same_attrs.merge(homework_common_id: homework.id)
|
|
|
|
worker.add same_attrs.merge(homework_common_id: homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -36,7 +36,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
course.exercises.each do |exercise|
|
|
|
|
course.exercises.each do |exercise|
|
|
|
|
next if exercise.exercise_users.where(user_id: user_id).any?
|
|
|
|
next if ExerciseUser.where(user_id: user_id, exercise_id: exercise.id).any?
|
|
|
|
worker.add same_attrs.merge(exercise_id: exercise.id)
|
|
|
|
worker.add same_attrs.merge(exercise_id: exercise.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -47,7 +47,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
same_attrs = {user_id: user_id}
|
|
|
|
course.polls.each do |poll|
|
|
|
|
course.polls.each do |poll|
|
|
|
|
next if poll.poll_users.where(user_id: user_id).any?
|
|
|
|
next if PollUser.where(user_id: user_id, poll_id: poll.id).any?
|
|
|
|
worker.add same_attrs.merge(poll_id: poll.id)
|
|
|
|
worker.add same_attrs.merge(poll_id: poll.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -58,7 +58,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
student_ids.each do |user_id|
|
|
|
|
same_attrs = {user_id: user_id, course_id: course.id}
|
|
|
|
same_attrs = {user_id: user_id, course_id: course.id}
|
|
|
|
course.graduation_tasks.each do |task|
|
|
|
|
course.graduation_tasks.each do |task|
|
|
|
|
next if task.graduation_works.where(user_id: user_id).any?
|
|
|
|
next if GraduationWork.where(user_id: user_id, graduation_task_id: task.id).any?
|
|
|
|
worker.add same_attrs.merge(graduation_task_id: task.id)
|
|
|
|
worker.add same_attrs.merge(graduation_task_id: task.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|