未发布的实训学生无法搜索

dev_local
daiao 6 years ago
parent 481209a955
commit 373de30f3b

@ -417,6 +417,12 @@ class ShixunsController < ApplicationController
else
@shixuns = @shixuns.order("shixuns.status = 2 desc, #{order} #{bsort}")
end
# 只有老师身份才能查看实训列表
unless User.current.is_certification_teacher || User.current.admin?
@shixuns = @shixuns.where("status > ?", 1)
end
@obj_count = @shixuns.count
@limit = 16
@is_remote = true

@ -939,7 +939,7 @@ class UsersController < ApplicationController
@limit = 16
if 1 == @index
# @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc")
@shixuns_result = Shixun.where("name like ? and hidden=0", "%#{@search}%").reorder("myshixuns_count desc")
@shixuns_result = Shixun.where("name like ? and hidden=0 and status = 2", "%#{@search}%").reorder("myshixuns_count desc")
@shixuns_result_count = @shixuns_result.count
@shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset

Loading…
Cancel
Save