实训作业的选用实训弹框、申请加入课堂时判断是否有同学号的用户存在

dev_forum
cxt 6 years ago
parent 03e5b0cf09
commit da6af76801

@ -883,7 +883,7 @@ class CoursesController < ApplicationController
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.where(user_id: same_student_id_users).size > 0
tip_exception("该课堂已存在同学号的学生,暂时无法加入,请联系老师") if course.students.exists?(user_id: same_student_id_users)
end
# 创建学生身份

Loading…
Cancel
Save