|
|
@ -157,8 +157,10 @@ class ChallengesController < ApplicationController
|
|
|
|
uid_logger("identifier: #{params}")
|
|
|
|
uid_logger("identifier: #{params}")
|
|
|
|
base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position,
|
|
|
|
base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position,
|
|
|
|
challenges.shixun_id, games.identifier, games.status"
|
|
|
|
challenges.shixun_id, games.identifier, games.status"
|
|
|
|
@challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id})
|
|
|
|
# 方便列表获取通关数
|
|
|
|
.select(base_columns)
|
|
|
|
@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:有判断权限,如果没发布,则肯定是管理人员
|
|
|
|
@editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员
|
|
|
|
@user = current_user
|
|
|
|
@user = current_user
|
|
|
|
@shixun.increment!(:visits)
|
|
|
|
@shixun.increment!(:visits)
|
|
|
|