Merge branch 'dev_jupyter' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

dev_daiao
guange 5 years ago
commit 9a12af098c

@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
unless Rails.env.development?
Rails.logger.info("66666 #{params}")
suffix = request.url.split(".").last.split("?").first
suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释
suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释
unless suffix_arr.include?(suffix)
if params[:client_key].present?
randomcode = params[:randomcode]

@ -147,7 +147,7 @@ class ShixunsController < ApplicationController
## 实训详情
def show
# 当前用户开启的实训
can_fork = current_user.is_certification_teacher || current_user.admin?
can_fork = current_user.is_certification_teacher || current_user.admin_or_business?
unless can_fork
@can_fork = {can_fork: "已经职业认证的教师才能fork实训",
certi_url: "/account/certification"}

@ -529,7 +529,7 @@ class StudentWorksController < ApplicationController
@echart_data = student_efficiency(@homework, @work)
@myself_eff = @echart_data[:efficiency_list].find { |item| item.last == @user.id }
@myself_consume = @echart_data[:consume_list].find { |item| item.last == @user.id }
filename_ = "#{@user&.student_id}_#{@user&.real_name}_#{@shixun&.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf"
filename_ = "#{@homework.course&.user_group_name(@work.user_id)}_#{@user&.student_id}_#{@user&.real_name}_#{@shixun&.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf"
filename = filename_.strip.tr("+/", "-_")
stylesheets = %w(shixun_work/shixun_work.css shared/codemirror.css)
if params[:export].present? && params[:export]

@ -10,7 +10,7 @@ class ExportShixunReportService
end
def filename
@_filename ||= "#{work.user&.student_id}_#{work.user.real_name}_#{homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf".gsub(' ', '-').gsub('/', '_')
@_filename ||= "#{homework.course&.user_group_name(work.user_id)}_#{work.user&.student_id}_#{work.user.real_name}_#{homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf".gsub(' ', '-').gsub('/', '_')
end
def prepare_binding
@ -43,6 +43,7 @@ class ExportShixunReportService
@user = @work.user
@shixun = homework.shixuns.take
@games = @work.myshixun.games.includes(:challenge, :game_codes,:outputs) if @work.myshixun
@challenges = @shixun.challenges if @shixun
# 用户最大评测次数
@user_evaluate_count = @games.pluck(:evaluate_count).sum if @games

@ -0,0 +1,50 @@
# 执行示例 bundle exec rake zip_pack:shixun_pack args=123,2323
namespace :zip_pack do
desc "手工打包作品"
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
task :shixun_pack => :environment do
if ENV['args']
homework_ids = ENV['args'].split(",").map(&:to_i)
homeworks = HomeworkCommon.where(id: homework_ids)
homeworks.includes(:score_student_works).each do |homework|
out_file_name = "#{Time.now.strftime("%Y%m%d%H%M%S").to_s}-#{homework.course_id}-#{homework.name}.zip"
out_file_name.gsub!(" ", "-")
out_file_name.gsub!("/", "_")
zipfile_name = "#{OUTPUT_FOLDER}/#{out_file_name}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
student_works = homework.score_student_works
if student_works.size > 0
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zip|
student_works.find_each.map do |student_work|
export = ExportShixunReportService.new(homework, student_work)
pdf = export.to_pdf
# pdfs << pdf
begin
zip.add(export.filename, pdf.path)
rescue => ex
Rails.logger.error(ex.message)
zip.get_output_stream('FILE_NOTICE.txt'){|os| os.write("文件重复:#{export.filename}") }
next
end
end
end
zipfile = zipfile_name
else
zipfile = {:message => "no file"}
end
puts "out: #{zipfile}"
end
end
end
def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident|Edge} ? ERB::Util.url_encode(name) : name
end
end

@ -174,7 +174,7 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.user_navlist_white a:hover{color: #4cacff}
.headIcon{height: 100%;box-sizing: border-box; margin: 0px!important;}
.black_nav_list{padding: 4px 0px;box-sizing: border-box;height: 100%;}
.black_nav_list li{line-height: 42px;height: 42px;color: #fff;cursor: pointer;}
.black_nav_list li{line-height: 40px;height: 40px;color: #fff;cursor: pointer;}
.black_nav_span{display: block;margin:0px 20px;border-bottom: 1px solid #4B4B4B;padding-left: 8px;color: #FAFAFA}
.welcome_shixun_index:last-child .black_nav_span{border-bottom: none}
.black_nav_list li:hover{background: #fff;}

@ -102,7 +102,7 @@ class SingleDisplay extends Component{
display: "flex",
flexDirection:"row",
}} key={optionIndex}>
<Radio disabled className="fl lineh-25" checked={item.standard_boolean}>{prefix}</Radio>
<Radio disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Radio>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
></MarkdownToHtml>
@ -116,7 +116,7 @@ class SingleDisplay extends Component{
display: "flex",
flexDirection:"row",
}} key={optionIndex}>
<Checkbox disabled className="fl lineh-25 mr8" checked={item.standard_boolean}>{prefix}</Checkbox>
<Checkbox disabled className="fl lineh-25 w50" checked={item.standard_boolean}>{prefix}</Checkbox>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
></MarkdownToHtml>

@ -143,4 +143,18 @@
/* 选中行边框 */
.monaco-editor .view-overlays .current-line {
border-width: 1px !important;
}
.monaco-editor .margin,
.monaco-editor .margin-view-overlays{
width: 54px !important;
text-align: center !important;
}
.monaco-editor .monaco-scrollable-element{
left: 54px !important;
}
.monaco-editor .margin-view-overlays .line-numbers{
text-align: center !important;
}

@ -318,6 +318,7 @@ class CodeEvaluateView extends Component {
*/
const _arrowClasses = isCollapse ? 'iconfont icon-xiajiantou btn-arrow' : 'iconfont icon-shangjiantou btn-arrow';
return (
<React.Fragment>
<ul id="blacktab_nav">
@ -330,11 +331,11 @@ class CodeEvaluateView extends Component {
<li className={`blacktab_con ${ tabIndex === 1 ? 'tab_hover' : ''}`} onClick={() => this.tabIndexChange(1)}>
<a href="javascript:void(0);" className="tab_type tab_color">测试结果</a>
</li>
<li className="blacktab_con_abs">
{this.props&&this.props.vnc_url?<li className="blacktab_con_abs">
<span className="code_evalute_icon" onClick={() => this.handleShowTestCase()}>
<span className={_arrowClasses}></span>
</span>
</li>
</li>:""}
{this.props.inDrawer ? <Tooltip id="tooltip-icon-expand" title={ showOrHide ? "收起" : "展开"}>
{/*TODO 按钮大小改造css*/}

@ -1039,17 +1039,17 @@ submittojoinclass=(value)=>{
`
}
</style>
<li className={`pr `}>
<Popover placement="bottom" content={contents} trigger="click" >
<div className=" sortinxdirection mr10">
<div style={{
color:"#fff"
}}>
题库
</div>
</div>
</Popover>
</li>
{/*<li className={`pr `}>*/}
{/* <Popover placement="bottom" content={contents} trigger="click" >*/}
{/* <div className=" sortinxdirection mr10">*/}
{/* <div style={{*/}
{/* color:"#fff"*/}
{/* }}>*/}
{/* 题库*/}
{/* </div>*/}
{/* </div>*/}
{/* </Popover>*/}
{/*</li>*/}

@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?2020`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?2021`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?2020`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?2021`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?2020`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?2021`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -239,7 +239,7 @@ render() {
{
shixunhoverData.map((item,key)=>{
return(
<Dropdown overlay={overlaymenu(item.sub_repertoires,item.id)} key={key} >
<Dropdown overlay={overlaymenu(item.sub_repertoires,item.id)} key={key} placement= {item.id<4?"bottomRight":item.id>=8?"bottomLeft":"bottomCenter"}>
<li key={key} className={parseInt(shixunsearchAllvalue)===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.id} onClick={this.shixunsearchAll}>
{item.name}
</li>

@ -178,7 +178,7 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.user_navlist_white a:hover{color: #4cacff}
.headIcon{height: 100%;box-sizing: border-box; margin: 0px!important;}
.black_nav_list{padding: 4px 0px;box-sizing: border-box;height: 100%;}
.black_nav_list li{line-height: 42px;height: 42px;color: #fff;cursor: pointer;}
.black_nav_list li{line-height: 40px;height: 40px;color: #fff;cursor: pointer;}
.black_nav_span{display: block;margin:0px 20px;border-bottom: 1px solid #4B4B4B;padding-left: 8px;color: #FAFAFA}
.welcome_shixun_index:last-child .black_nav_span{border-bottom: none}
.black_nav_list li:hover{background: #fff;}

Loading…
Cancel
Save