代码优化

dev_forum
daiao 5 years ago
parent b12a766f9e
commit 069571bec2

@ -160,8 +160,8 @@ class ChallengesController < ApplicationController
def show
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
challenge_num = Challenge.where(shixun_id: @shixun).count
@power = current_user.manager_of_shixun?(@shixun) && @shixun.status == 0
challenge_num = @shixun.challenges_count
@power = @shixun.status == 0 # 之前验证走过了是不是管理员,因此这里只用判断是否发布
@position = @challenge.position
if @position < challenge_num
@next_challenge = Challenge.where(:shixun_id => @shixun, :position => @position + 1).first

Loading…
Cancel
Save