dev_forum
cxt 5 years ago
parent bb28f494f8
commit 65463d855e

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

Loading…
Cancel
Save