diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e96d9eaaf..eae04490a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -665,10 +665,14 @@ module ApplicationHelper Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).count > 0 ? true : false end - # 用户必须登录;必须创建了关卡;必须提交了版本库代码 + # 用户必须登录;必须创建了关卡;有实践任务的必须提交了版本库代码 def allow_shixun_exec shixun g = Gitlab.client - (User.current.logged? && shixun.challenges.count > 0 && g.trees(shixun.gpid).count.to_i > 0) + result = User.current.logged? && shixun.challenges.count > 0 + if shixun.challenges.where(:st => 0).count > 0 + result = result && g.trees(shixun.gpid).count.to_i > 0 + end + result end # 判断当前用户是否可以开始实战 diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 468809166..619724db4 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -33,7 +33,7 @@ <% stage.stage_shixuns.each_with_index do |stage_shixun, index| %> <% shixun = stage_shixun.shixun %>