diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 883efe6e3..1b38223cd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -144,8 +144,8 @@ module ApplicationHelper Myshixun.where(:user_id => User.current.id, :parent_id => shixun.id).count > 0 ? true : false end - def tpi_allow_show shixun - (User.current.logged? && User.current.id != shixun.user_id) + def allow_shixun_exec shixun + (User.current.logged? && User.current.id != shixun.user_id && shixun.status == 1) end # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 diff --git a/app/models/shixun.rb b/app/models/shixun.rb index e0c6f6fa3..22da9a7e3 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -1,4 +1,4 @@ -# status 控制实训的状态,0:未开启;1: 已开启(TPM) 2: 子项目(TPI) +# status 控制实训的状态,0:未开启;1: 已开启(TPM) class Shixun < ActiveRecord::Base attr_accessible :description, :is_public, :name, :parent_id, :changeset_num, :forked_form, :status, :user_id, :gpid, :forked_count diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index d23af7500..a5aa28d2e 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -11,7 +11,7 @@ <%=link_to @shixun.name, shixun_path(@shixun), :class => "pro_new_username break_word" %> - <% if tpi_allow_show(@shixun) %> + <% if allow_shixun_exec(@shixun) %>