From 7ed9d4554f7c57f673845edad8185ec65e1c88ac Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Mar 2020 17:46:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9E=E8=AE=AD=E5=85=B3?= =?UTF-8?q?=E5=8D=A1=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index d38a10efc..6b46ea7a9 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -157,9 +157,10 @@ class ChallengesController < ApplicationController uid_logger("identifier: #{params}") base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position, challenges.shixun_id, games.identifier, games.status" - # 方便列表获取通关数和游玩数 + # 下面2个参数是为了解决列表获取通关人数与正在游玩人数的问题 @pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count @play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count + @challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id}).select(base_columns) @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 @user = current_user