From e621a54f06ded6fe0b558ab3b6bd282d47520b9b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 29 Mar 2019 16:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E8=A2=AB=E2=80=9C=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E2=80=9D=E5=90=8E=EF=BC=8C=E8=AF=B7=E6=82=AC=E6=B5=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E2=80=9C=E6=9A=82=E6=9C=AA=E5=85=AC=E5=BC=80=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/subjects_helper.rb | 58 ++++++++++--------- app/views/subjects/_paths_list.html.erb | 2 +- ...80718_migrate_homework_common_end_time2.rb | 13 +++++ 3 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 db/migrate/20190329080718_migrate_homework_common_end_time2.rb 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