|
|
|
@ -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)
|
|
|
|
|