Merge branch 'develop' into educoder

dev_haigong
cxt 6 years ago
commit 29001ced81

@ -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

@ -6,8 +6,11 @@ module SubjectsHelper
end
# 实训路径详情列表,右侧状态显示栏
def shixun_show_in_subject subject_status, shixun_status
content = if subject_status < 2
def shixun_show_in_subject subject_status, shixun_status, shixun_hidden
content = if shixun_hidden
'<span class="fr color-grey-c">暂未公开</span>'
else
if subject_status < 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
@ -32,6 +35,7 @@ module SubjectsHelper
""
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 = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>"
if User.current.try(:mail).blank?
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}

@ -61,7 +61,7 @@
<span class="paragraph_name <%= shixun.status < 2 && !is_shixun_manager ? "color-grey-c" : "color-grey3" %>"><span class="subject_stage_shixun_index"><%= s_index + 1 %></span>-<%= index + 1 %>&nbsp;&nbsp;<%= shixun.name %></span>
</li>
<li class="fr status_li">
<%= 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 %>
</li>
</div>

@ -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

@ -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
Loading…
Cancel
Save