From e6f5a2b13a314ab4ec6625cd7ea19f545a0b38b8 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 3 Jul 2019 10:58:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84xlsx=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA=E7=9A=84=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 2fcf45cda..c5cf7390f 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1298,9 +1298,16 @@ class ExercisesController < ApplicationController end if params[:format] == "xlsx" + logger.info("#######___________params_xlsx____________##########") + logger.info("#######___________@exercise_users_size____________##########{@exercise_users_size}") + logger.info("#######___________@export_ex_users&.exercise_user_committed.size____________##########{@export_ex_users&.exercise_user_committed.size}") + + if @user_course_identity > Course::ASSISTANT_PROFESSOR tip_exception(403,"无权限操作") elsif (@exercise_users_size == 0) || ( @export_ex_users&.exercise_user_committed.size == 0) + logger.info("#######___________@exercise_users_size == 0____________##########") + normal_status(-1,"暂无用户提交") else respond_to do |format| @@ -1312,18 +1319,7 @@ class ExercisesController < ApplicationController } end end - # else - # respond_to do |format| - # format.json - # format.xlsx{ - # get_export_users(@exercise,@course,@export_ex_users) - # exercise_export_name = - # "#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" - # render xlsx: "#{exercise_export_name.strip.first(30)}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns} - # } - # end end - rescue Exception => e uid_logger_error(e.message) tip_exception("页面调用失败!")