From 6270a90b0b0d096ebb46dff5a3104be473d238b5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Mar 2020 16:57:34 +0800 Subject: [PATCH] fixbug --- app/controllers/challenges_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index cf8fc7cbf..b7aa4b6e4 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -155,11 +155,10 @@ class ChallengesController < ApplicationController def index uid_logger("identifier: #{params}") - #bases_column = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position, - # challenges.shixun_id, games.identifier, games.status" - #@challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id}) - # .select(bases_column) - @challenges = @shixun.challenges.fields_for_list + base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position, + challenges.shixun_id, games.identifier, games.status" + @challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id}) + .select(base_columns) @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 @user = current_user @shixun.increment!(:visits)