From 152fcd9bc454d850ccd31e1dea392f9a5abd652c Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 22 Jun 2019 14:49:57 +0800 Subject: [PATCH] fix bug --- app/controllers/homework_commons_controller.rb | 13 +++++++++---- .../exercise_export/blank_exercise.html.erb | 2 +- app/templates/exercise_export/exercise_export.css | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index ec3f0ab9a..5e8f7b67e 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -200,10 +200,15 @@ class HomeworkCommonsController < ApplicationController if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") else - student_work_to_xlsx(@work_excel,@homework) - exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S') - render xlsx: "#{exercise_export_name.strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals: - {table_columns: @work_head_cells,task_users: @work_cells_column} + if @work_excel.size > 0 + student_work_to_xlsx(@work_excel,@homework) + exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S') + render xlsx: "#{exercise_export_name.strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals: + {table_columns: @work_head_cells,task_users: @work_cells_column} + else + normal_status(-1,"暂无提交的学生!") + end + end } format.zip{ diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index 123e114b1..53466929d 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -18,7 +18,7 @@
-
+
<% if @exercise_single_ques_count > 0 %> 单选题<%= @exercise_single_ques_count %>题, diff --git a/app/templates/exercise_export/exercise_export.css b/app/templates/exercise_export/exercise_export.css index 4747e9eed..454bb1c26 100644 --- a/app/templates/exercise_export/exercise_export.css +++ b/app/templates/exercise_export/exercise_export.css @@ -306,6 +306,10 @@ textarea{ .max-100{ max-width:100%; } +.width100{ + width:100%; + word-break:normal; +}