优化代码

dev_forum
daiao 5 years ago
parent d73ee9716d
commit 6cf53047c3

@ -138,7 +138,7 @@ class ChallengesController < ApplicationController
# tab 0,nil 过关任务, 1 评测设置, 2 参考答案 # tab 0,nil 过关任务, 1 评测设置, 2 参考答案
def edit def edit
@tab = params[:tab].to_i @tab = params[:tab].to_i
@power = current_user.manager_of_shixun?(@shixun) && @shixun.status == 0 @power = @shixun.status == 0
challenge_num = Challenge.where(:shixun_id => @shixun).count challenge_num = Challenge.where(:shixun_id => @shixun).count
@position = @challenge.position @position = @challenge.position
@chooses = @challenge.challenge_chooses @chooses = @challenge.challenge_chooses
@ -279,9 +279,6 @@ class ChallengesController < ApplicationController
def find_shixun def find_shixun
@shixun = Shixun.find_by_identifier(params[:shixun_identifier]) @shixun = Shixun.find_by_identifier(params[:shixun_identifier])
if !current_user.shixun_permission(@shixun)
tip_exception(403, "..")
end
end end
# 通用接口 # 通用接口

Loading…
Cancel
Save