题库点击发送到后,先输入一个不存在的课程ID,点击确定,在出现请先选择课程的提示后删除输入的ID,此时会显示出该用户所有的课程,包括已经删除的

This commit is contained in:
cxt 2016-06-03 17:03:53 +08:00
parent b20dc06e23
commit 07941233d8
1 changed files with 1 additions and 1 deletions

View File

@ -575,7 +575,7 @@ class UsersController < ApplicationController
end
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
else
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
end