From b7b1f3591304472ca8d24cada29c4e4572907463 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 28 Mar 2019 15:42:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E7=BC=96=E7=A0=81=E6=A0=BC=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 5c9ef13c..d5e8c682 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -812,7 +812,7 @@ class ManagementsController < ApplicationController format.xls{ shixun_ids = @all_discusses.pluck(:dis_id).uniq filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls" - send_data(shixun_feedback_xls(shixun_ids), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + send_data(shixun_feedback_xls(shixun_ids), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename)) } end end From cfcfc9c58072158ed11b1316821c022fef75b733 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 29 Mar 2019 15:59:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0329070441_migrate_homework_common_end_times.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 db/migrate/20190329070441_migrate_homework_common_end_times.rb diff --git a/db/migrate/20190329070441_migrate_homework_common_end_times.rb b/db/migrate/20190329070441_migrate_homework_common_end_times.rb new file mode 100644 index 00000000..0fa7b6cb --- /dev/null +++ b/db/migrate/20190329070441_migrate_homework_common_end_times.rb @@ -0,0 +1,14 @@ +class MigrateHomeworkCommonEndTimes < ActiveRecord::Migration + def up + homework_commons = HomeworkCommon.where("id < 21549") + homework_commons.find_each do |homework| + sql = "update homework_commons set end_time = (select max(end_time) from + homework_seconds where id = #{homework.id}) where id = #{homework.id}" + + ActiveRecord::Base.connection.execute(sql) + end + end + + def down + end +end 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 3/3] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=AE=9E=E8=AE=AD=E8=A2=AB=E2=80=9C=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E2=80=9D=E5=90=8E=EF=BC=8C=E8=AF=B7=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E2=80=9C=E6=9A=82=E6=9C=AA=E5=85=AC=E5=BC=80?= =?UTF-8?q?=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