diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index c81d560b..0a8d659f 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -6,32 +6,36 @@ module SubjectsHelper end # 实训路径详情列表,右侧状态显示栏 - def shixun_show_in_subject subject_status, shixun_status - content = if subject_status < 2 - case shixun_status - when 0, 1 - '暂未公开' - when 2 - '已发布' - when 3 - '已关闭' - else - "" - end - else - if shixun_status != 2 - case shixun_status - when 0, 1 - '暂未公开' - when 3 - '已关闭' - else - "" - end - else - "" - end - end + def shixun_show_in_subject subject_status, shixun_status, shixun_hidden + content = if shixun_hidden + '暂未公开' + else + if subject_status < 2 + case shixun_status + when 0, 1 + '暂未公开' + when 2 + '已发布' + when 3 + '已关闭' + else + "" + end + else + if shixun_status != 2 + case shixun_status + when 0, 1 + '暂未公开' + when 3 + '已关闭' + else + "" + end + else + "" + end + end + end return content.html_safe end @@ -39,7 +43,7 @@ module SubjectsHelper def start_shixun_in_subject subject, shixun, myshixun is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => shixun.try(:id), :status => 1).first content_before = '' - content = if shixun.status == 2 || User.current.manager_of_shixun?(shixun) + content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun) content_before = "查看详情" if User.current.try(:mail).blank? %Q{开始实战} diff --git a/app/views/subjects/_paths_list.html.erb b/app/views/subjects/_paths_list.html.erb index 615eaa18..fdd5e262 100644 --- a/app/views/subjects/_paths_list.html.erb +++ b/app/views/subjects/_paths_list.html.erb @@ -61,7 +61,7 @@ "><%= s_index + 1 %>-<%= index + 1 %>  <%= shixun.name %>
  • - <%= shixun_show_in_subject @subject.status, shixun.status %> + <%= shixun_show_in_subject @subject.status, shixun.status, shixun.hidden %> <%= start_shixun_in_subject @subject, shixun, myshixun %>
  • diff --git a/db/migrate/20190329080718_migrate_homework_common_end_time2.rb b/db/migrate/20190329080718_migrate_homework_common_end_time2.rb new file mode 100644 index 00000000..65d4670a --- /dev/null +++ b/db/migrate/20190329080718_migrate_homework_common_end_time2.rb @@ -0,0 +1,13 @@ +class MigrateHomeworkCommonEndTime2 < ActiveRecord::Migration + def up + homework_commons = HomeworkCommon.where("id >= 21549") + homework_commons.each do |homework| + if homework.publish_time.nil? + homework.update_column('end_time', nil) + end + end + end + + def down + end +end