From b594e4b509aa50406744c489af90113b314a2962 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 16:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixun_work/shixun_work.html.erb | 607 +++++++++--------- lib/tasks/zip_pack.rake | 4 +- 2 files changed, 309 insertions(+), 302 deletions(-) diff --git a/app/templates/shixun_work/shixun_work.html.erb b/app/templates/shixun_work/shixun_work.html.erb index bbc81f373..76a269f3f 100644 --- a/app/templates/shixun_work/shixun_work.html.erb +++ b/app/templates/shixun_work/shixun_work.html.erb @@ -101,85 +101,86 @@ -
-

- 图形统计 -

-
- -
- -
-
-
-
-
+ <% if @work.myshixun.present? %> +
+

+ 图形统计 +

+
-
-
-
-
  • 姓名
  • -
  • 学号
  • -
  • 工作效率
  • +
    + +
    -
    -
  • <%= @user.real_name %>
  • -
  • <%= @user.student_id %>
  • -
  • <%= @myself_eff[1] %>
  • +
    -
    - -
    -
    + +
    +
  • 姓名
  • 学号
  • -
  • 能力
  • +
  • 工作效率
  • -
  • <%= @user.real_name %>
  • +
  • <%= @user.real_name %>
  • <%= @user.student_id %>
  • -
  • <%= @myself_consume[1] %>
  • +
  • <%= @myself_eff[1] %>
  • - +
    -
    -
    -

    - 实训详情 -

    - <%#= ApplicationController.helpers.javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %> - <% @games.each_with_index do |game, index| %> -
    -

    +

    +

    + 实训详情 +

    + <%#= ApplicationController.helpers.javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %> + <% @games.each_with_index do |game, index| %> +
    +

    <% if game.challenge.st == 1 %> @@ -187,43 +188,44 @@ <% end %> - 第<%= index+1 %>关<%= game.challenge.subject %> -

    -
    - <% if game.outputs.present? %> - - - - - - - <% outputs = game.outputs.group("query_index") %> - <% max_query = outputs.map(&:query_index).max %> - <% outputs.reverse.try(:each) do |output| %> - - - - - <% end %> - -
    评测次数评测信息
    <%= max_query == output.query_index ? "最后一次" : "第#{output.query_index}次" %><%= output_detail(game, output) %>
    - <% end %> - <% if game.try(:lastest_code).present? && game.challenge.st == 0 %> -
    -

    - 最近通过的代码 -

    -
    -
  • - -
  • + 第<%= index+1 %>关<%= game.challenge.subject %> +

    +
    + <% if game.outputs.present? %> + + + + + + + <% outputs = game.outputs.group("query_index") %> + <% max_query = outputs.map(&:query_index).max %> + <% outputs.reverse.try(:each) do |output| %> + + + + + <% end %> + +
    评测次数评测信息
    <%= max_query == output.query_index ? "最后一次" : "第#{output.query_index}次" %><%= output_detail(game, output) %>
    + <% end %> + <% if game.try(:lastest_code).present? && game.challenge.st == 0 %> +
    +

    + 最近通过的代码 +

    +
    +
  • + +
  • +
    -
    - <% end %> + <% end %> +
    -
    - <% end %> -
    + <% end %> +
    + <% end %>
    @@ -261,215 +263,220 @@ // 基于准备好的dom,初始化echarts实例 - var effChart = echarts.init(document.getElementById('shixun_skill_chart')); - // 指定图表的配置项和数据 - var option = { - grid: { - left: '3%', - right: '9%', - bottom: '3%', - containLabel: true - }, - tooltip : {}, - xAxis : [ - { - type : 'value', - name: '学生序号', - scale:true, - axisLabel : { - formatter: ' ' - }, - axisTick:{ - show:false - }, - splitLine: { - show: false - } - } - ], - yAxis : [ - { - type : 'value', - name : '工作效率', - scale:true, - axisLabel : { - formatter: '{value} ' - }, - splitLine: { - show: false - } - } - ], - series : [ - { - name:'', - type:'scatter', - data: <%= @echart_data[:efficiency_list] %>, - itemStyle:{ - normal:{color:'#2e65ad'} - }, - markArea: { - silent: true, - itemStyle: { - normal: { - color: 'transparent', - borderWidth: 1, - borderType: 'dashed' - } - } - }, - markPoint : { - data : [ - { - name: 'daiao', - xAxis:<%= @myself_eff[0] %>, - yAxis:<%= @myself_eff[1] %> - } - ], - itemStyle: { - normal:{ - color:'#c23531' - } - } - }, - markLine : { - lineStyle: { - normal: { - type: 'solid', - color:'#c23531' - } + if(document.getElementById('shixun_skill_chart')){ + var effChart = echarts.init(document.getElementById('shixun_skill_chart')); + // 指定图表的配置项和数据 + var option = { + grid: { + left: '3%', + right: '9%', + bottom: '3%', + containLabel: true }, - data : [ - {type : 'average', name: '中位值'} + tooltip : {}, + xAxis : [ + { + type : 'value', + name: '学生序号', + scale:true, + axisLabel : { + formatter: ' ' + }, + axisTick:{ + show:false + }, + splitLine: { + show: false + } + } + ], + yAxis : [ + { + type : 'value', + name : '工作效率', + scale:true, + axisLabel : { + formatter: '{value} ' + }, + splitLine: { + show: false + } + } + ], + series : [ + { + name:'', + type:'scatter', + data: <%= @echart_data[:efficiency_list] %>, + itemStyle:{ + normal:{color:'#2e65ad'} + }, + markArea: { + silent: true, + itemStyle: { + normal: { + color: 'transparent', + borderWidth: 1, + borderType: 'dashed' + } + } + }, + markPoint : { + data : [ + { + name: 'daiao', + xAxis:<%= @myself_eff[0] %>, + yAxis:<%= @myself_eff[1] %> + } + ], + itemStyle: { + normal:{ + color:'#c23531' + } + } + }, + markLine : { + lineStyle: { + normal: { + type: 'solid', + color:'#c23531' + } + }, + data : [ + {type : 'average', name: '中位值'} + ] + } + }, + { + name:'二班', + type:'scatter', + data: [<%= @myself_eff %>], + itemStyle:{ + color:'#c23531' + } + } ] - } - }, - { - name:'二班', - type:'scatter', - data: [<%= @myself_eff %>], - itemStyle:{ - color:'#c23531' - } - } - ] - }; - // 使用刚指定的配置项和数据显示图表 - effChart.setOption(option); - console.debug(<%= @myself_consume %>); - var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart')); - var dataBJ = <%= @echart_data[:consume_list] %>; - var schema = [ - {name: 'date', index: 0, text: '日'}, - {name: 'AQIindex', index: 1, text: 'AQI指数'}, - {name: 'PM25', index: 2, text: 'PM2.5'} - ]; + }; + // 使用刚指定的配置项和数据显示图表 + effChart.setOption(option); + console.debug(<%= @myself_consume %>); + } - var itemStyle = { - normal: { - opacity: 0.8, - shadowBlur: 10, - shadowOffsetX: 0, - shadowOffsetY: 0, - shadowColor: 'rgba(0, 0, 0, 0)', - color:'#2e65ad' - } - }; - var itemStyle1 = { - normal: { - opacity: 0.8, - shadowBlur: 10, - shadowOffsetX: 0, - shadowOffsetY: 0, - shadowColor: 'rgba(0, 0, 0, 0)', - color:'#c23531' - } - }; + if(document.getElementById('shixun_skill_chart')) { + var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart')); + var dataBJ = <%= @echart_data[:consume_list] %>; + var schema = [ + {name: 'date', index: 0, text: '日'}, + {name: 'AQIindex', index: 1, text: 'AQI指数'}, + {name: 'PM25', index: 2, text: 'PM2.5'} + ]; - var option1 = { - backgroundColor: '#fff', - color: [ - '#dd4444', '#fec42c', '#80F1BE' - ], - grid: { - x: '10%', - x2: 150, - y: '18%', - y2: '10%' - }, - tooltip: {}, - xAxis: { - type: 'value', - name: 'log(实训的总时间)', - nameGap: 16, - nameTextStyle: { - color: '#000', - fontSize: 14 - }, - splitLine: { - show: false - }, - axisLine: { - lineStyle: { - color: '#000' - } - } - }, - yAxis: { - type: 'value', - name: '总分数/评测次数', - nameLocation: 'end', - nameGap: 20, - nameTextStyle: { - color: '#000', - fontSize: 16 - }, - axisLine: { - lineStyle: { - color: '#000' - } - }, - splitLine: { - show: false - } - }, - series: [ - { - name: '能力', - type: 'scatter', - itemStyle: itemStyle, - data: dataBJ, - symbolSize: function (value){ - return Math.round(value[2]); - }, - markPoint : { - data : [ - { - name: 'daiao', - xAxis:<%= @myself_consume[0] %>, - yAxis:<%= @myself_consume[1] %> + var itemStyle = { + normal: { + opacity: 0.8, + shadowBlur: 10, + shadowOffsetX: 0, + shadowOffsetY: 0, + shadowColor: 'rgba(0, 0, 0, 0)', + color:'#2e65ad' } - ], - itemStyle: { - normal:{ - color:'#c23531' + }; + var itemStyle1 = { + normal: { + opacity: 0.8, + shadowBlur: 10, + shadowOffsetX: 0, + shadowOffsetY: 0, + shadowColor: 'rgba(0, 0, 0, 0)', + color:'#c23531' } - } - } - }, - { - name: '能力1', - type: 'scatter', - data:[<%= @myself_consume %>], - itemStyle:itemStyle1, - symbolSize: function (val){ - return Math.round(val[2]); - } - } - ] - }; - // 使用刚指定的配置项和数据显示图表。 - ablChart.setOption(option1); + }; + + var option1 = { + backgroundColor: '#fff', + color: [ + '#dd4444', '#fec42c', '#80F1BE' + ], + grid: { + x: '10%', + x2: 150, + y: '18%', + y2: '10%' + }, + tooltip: {}, + xAxis: { + type: 'value', + name: 'log(实训的总时间)', + nameGap: 16, + nameTextStyle: { + color: '#000', + fontSize: 14 + }, + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#000' + } + } + }, + yAxis: { + type: 'value', + name: '总分数/评测次数', + nameLocation: 'end', + nameGap: 20, + nameTextStyle: { + color: '#000', + fontSize: 16 + }, + axisLine: { + lineStyle: { + color: '#000' + } + }, + splitLine: { + show: false + } + }, + series: [ + { + name: '能力', + type: 'scatter', + itemStyle: itemStyle, + data: dataBJ, + symbolSize: function (value){ + return Math.round(value[2]); + }, + markPoint : { + data : [ + { + name: 'daiao', + xAxis:<%= @myself_consume[0] %>, + yAxis:<%= @myself_consume[1] %> + } + ], + itemStyle: { + normal:{ + color:'#c23531' + } + } + } + }, + { + name: '能力1', + type: 'scatter', + data:[<%= @myself_consume %>], + itemStyle:itemStyle1, + symbolSize: function (val){ + return Math.round(val[2]); + } + } + ] + }; + // 使用刚指定的配置项和数据显示图表。 + ablChart.setOption(option1); + } } diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 7eb757f08..0452a83e2 100644 --- a/lib/tasks/zip_pack.rake +++ b/lib/tasks/zip_pack.rake @@ -1,7 +1,7 @@ # 执行示例 bundle exec rake zip_pack:shixun_pack args=123,2323 namespace :zip_pack do desc "手工打包作品" - OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" + OUTPUT_FOLDER = "/tmp" task :shixun_pack => :environment do @@ -23,7 +23,7 @@ namespace :zip_pack do student_works.find_each.map do |student_work| export = ExportShixunReportService.new(homework, student_work) pdf = export.to_pdf - # pdfs << pdf + pdfs << pdf begin zip.add(export.filename, pdf.path) rescue => ex