|
|
|
@ -884,11 +884,11 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 验证是否存在同学号的学生
|
|
|
|
|
u_extension = current_user.user_extension
|
|
|
|
|
if params[:student].present? && u_extension.student?
|
|
|
|
|
same_student_id_users = UserExtension.where.not(user_id: current_user.id).where(student_id: u_extension.student_id, identity: %i[student], school_id: u_extension.school_id).pluck(:user_id)
|
|
|
|
|
tip_exception("该课堂已存在同学号的学生,暂时无法加入,请联系老师") if course.students.exists?(user_id: same_student_id_users)
|
|
|
|
|
end
|
|
|
|
|
# u_extension = current_user.user_extension
|
|
|
|
|
# if params[:student].present? && u_extension.student?
|
|
|
|
|
# same_student_id_users = UserExtension.where.not(user_id: current_user.id).where(student_id: u_extension.student_id, identity: %i[student], school_id: u_extension.school_id).pluck(:user_id)
|
|
|
|
|
# tip_exception("该课堂已存在同学号的学生,暂时无法加入,请联系老师") if course.students.exists?(user_id: same_student_id_users)
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
# 创建学生身份
|
|
|
|
|
if params[:student].present?
|
|
|
|
@ -906,6 +906,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id])
|
|
|
|
|
StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id)
|
|
|
|
|
logger_error("#####################{course.id}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|