diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index e3ecc2ce..5df43ed6 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2023,7 +2023,7 @@ end # @schools = School.where(:id =>user_exs.map(&:school_id)) # end @search = params[:search] # 搜索字 - @keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 + @keyword = params[:keyword].blank? ? "c_name" : params[:keyword] # 根据姓名/课程名搜索 @status = params[:status] @school_id = params[:school_id] @@ -2044,11 +2044,13 @@ end if params[:status] && params[:status]!='' @courses = @courses.where(:is_end => @status.to_i) end - if "u_name" == @keyword + if "c_name" == @keyword + @courses = @courses.where("name like ?", "%#{@search}%") + elsif "u_name" == @keyword if @search.blank? @courses = @courses else - user_id = User.where("concat(lastname, firstname) like '%#{@search}%'") + # user_id = User.where("concat(lastname, firstname) like '%#{@search}%'") @courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'") end elsif "dep_name" == @keyword diff --git a/app/views/managements/classroom_classment.html.erb b/app/views/managements/classroom_classment.html.erb index 06ea072d..f9417d74 100644 --- a/app/views/managements/classroom_classment.html.erb +++ b/app/views/managements/classroom_classment.html.erb @@ -14,6 +14,7 @@