|
|
@ -12,9 +12,9 @@ class CoursesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
|
|
|
|
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
|
|
|
|
:left_banner, :top_banner, :apply_to_join_course]
|
|
|
|
|
|
|
|
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
|
|
|
|
|
|
|
|
:left_banner, :top_banner]
|
|
|
|
:left_banner, :top_banner]
|
|
|
|
|
|
|
|
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
|
|
|
|
|
|
|
|
:left_banner, :top_banner, :apply_to_join_course]
|
|
|
|
before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,
|
|
|
|
before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt,
|
|
|
|
:set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers,
|
|
|
|
:set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers,
|
|
|
|
:top_banner, :left_banner, :add_teacher_popup, :add_teacher,
|
|
|
|
:top_banner, :left_banner, :add_teacher_popup, :add_teacher,
|
|
|
@ -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.info("#####################{course.id}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|