|
|
|
@ -206,10 +206,18 @@ class UsersService
|
|
|
|
|
}
|
|
|
|
|
scope = User.logged.status(status)
|
|
|
|
|
if params[:is_search_assitant].nil?
|
|
|
|
|
watcher = User.watched_by(params[:user_id])
|
|
|
|
|
watcher.push(params[:user_id])
|
|
|
|
|
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件(bug:#2270) start
|
|
|
|
|
#say by yutao: params[:user_id]这个是指谁发起的搜索么? 如果是 这个值貌似应该从session获取 怪怪的赶脚-_-!
|
|
|
|
|
search_by = params[:search_by] ? params[:search_by] : "0"
|
|
|
|
|
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
|
|
|
|
|
if params[:name].present?
|
|
|
|
|
if !params[:user_id].nil?
|
|
|
|
|
watcher = User.watched_by(params[:user_id])
|
|
|
|
|
watcher.push(params[:user_id])
|
|
|
|
|
scope = scope.where("id not in (?)",watcher)
|
|
|
|
|
end
|
|
|
|
|
scope = scope.like(params[:name],search_by)
|
|
|
|
|
end
|
|
|
|
|
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
|
|
|
|
|
else
|
|
|
|
|
teachers = searchTeacherAndAssistant(Course.find(params[:course_id]))
|
|
|
|
|
scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present?
|
|
|
|
|