|
|
|
@ -467,7 +467,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
# user_ids_of_course_members = @course.course_members.where(role: [1,2,3]).pluck(:user_id)
|
|
|
|
|
# @users = User.where.not(id: user_ids_of_course_members)
|
|
|
|
|
|
|
|
|
|
@users = User.where(status: User::STATUS_ACTIVE)
|
|
|
|
|
@users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id)
|
|
|
|
|
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
|
|
|
|
|
# REDO:Extension
|
|
|
|
|
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?
|
|
|
|
@ -1083,7 +1083,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
school_name = params[:school_name]
|
|
|
|
|
|
|
|
|
|
# REDO:Extension
|
|
|
|
|
@users = User.where(status: User::STATUS_ACTIVE)
|
|
|
|
|
@users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id)
|
|
|
|
|
@users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present?
|
|
|
|
|
# REDO:Extension
|
|
|
|
|
@users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present?
|
|
|
|
@ -1103,12 +1103,12 @@ class CoursesController < ApplicationController
|
|
|
|
|
# 邀请码验证
|
|
|
|
|
return normal_status(-1, "邀请码不能为空") if params[:invite_code].blank?
|
|
|
|
|
invite_code = params[:invite_code]
|
|
|
|
|
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0)
|
|
|
|
|
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id)
|
|
|
|
|
course_group = CourseGroup.find_by(invite_code: invite_code)
|
|
|
|
|
if course.blank?
|
|
|
|
|
return normal_status(-1, "邀请码无效") if course_group.blank?
|
|
|
|
|
|
|
|
|
|
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0)
|
|
|
|
|
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id)
|
|
|
|
|
return normal_status(-1, "邀请码无效") if course.blank?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|