diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index de24f7a8e..b08ba2dbd 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1299,8 +1299,10 @@ class CoursesController < ApplicationController begin @all_members = @course.students search = params[:search] ? "#{params[:search].strip}" : "" #用户名或学生学号id搜索 - group_id = params[:group_id] #分班的班级id - @all_members = @all_members.where(course_group_id: group_id.map(&:to_i)) unless group_id.blank? + if params[:group_id].present? + group_ids = params[:group_id].is_a?(String) ? [params[:group_id].to_i] : params[:group_id].map(&:to_i) + @all_members = @all_members.where(course_group_id: group_ids) + end unless search.blank? @all_members = @all_members.joins(user: [:user_extension]).where('concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?',"%#{search}%","%#{search}%") end