From 373de30f3b84fff21fef57af1ca171a00c6bf698 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 22 May 2019 14:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E5=8F=91=E5=B8=83=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E5=AD=A6=E7=94=9F=E6=97=A0=E6=B3=95=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 6 ++++++ app/controllers/users_controller.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3367e379..0222437e 100755 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a4ac1388..b564e2af 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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