From d48d25197a27d602e0ca641f90d2fdd915236ec6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 24 Oct 2019 09:39:45 +0800 Subject: [PATCH] =?UTF-8?q?tpm=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=A2=AB?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=9A=84=E8=AF=84=E8=AE=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discusses_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 6ddf71ba4..c0deac091 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -7,6 +7,8 @@ class DiscussesController < ApplicationController def index page = params[:page].to_i offset = page * LIMIT + @manger = @container.has_manager?(current_user) || current_user.is_certification_teacher + # 总数,分页使用 if current_user.admin? @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count @@ -18,7 +20,6 @@ class DiscussesController < ApplicationController {dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id}) @disscuss_count = disscusses.count("discusses.id") end - @manger = @container.has_manager?(current_user) if @manger @discusses = disscusses.limit(LIMIT).joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") .select("discusses.*, games.identifier").includes(:user, :praise_treads).offset(offset)