dev_course
SylorHuang 5 years ago
parent fa72a7880c
commit f6ae3f3293

@ -208,7 +208,7 @@ class HomeworkCommonsController < ApplicationController
student_work_to_xlsx(@work_excel,@homework) 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') 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: render xlsx: "#{exercise_export_name.encode('UTF-8', 'gb2312', {:invalid => :replace, :undef => :replace, :replace => ' '}).strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals:
{table_columns: @work_head_cells,task_users: @work_cells_column} {table_columns: @work_head_cells,task_users: @work_cells_column}
} }
end end

@ -10,9 +10,8 @@ class ZipsController < ApplicationController
service = BatchExportShixunReportService.new(@homework, @all_student_works) service = BatchExportShixunReportService.new(@homework, @all_student_works)
filename = filename_for_content_disposition(service.filename) filename = filename_for_content_disposition(service.filename)
Rails.logger.info("################___________file_name________________###########{filename}")
Rails.logger.info("################___________service.filename________________###########{service.filename}") send_file service.zip, filename: filename, type: 'application/zip'
send_file service.zip, filename: filename.encode(Encoding.default_external, 'gb2312'), type: 'application/zip'
rescue BatchExportShixunReportService::Error => ex rescue BatchExportShixunReportService::Error => ex
normal_status(-1, ex.message) normal_status(-1, ex.message)
end end

@ -40,10 +40,17 @@ module ExportHelper
works.includes(user: :user_extension, student_works_scores: :user).each_with_index do |w, index| works.includes(user: :user_extension, student_works_scores: :user).each_with_index do |w, index|
w_user = w.user w_user = w.user
w_1 = (index + 1) w_1 = (index + 1)
w_2 = w_user.login if w_user.present?
w_3 = w_user.real_name w_2 = w_user&.login
w_3_1 = w_user.mail w_3 = w_user&.real_name
w_3_1 = w_user&.mail
w_4 = w_user.student_id.present? ? w_user.student_id : "--" w_4 = w_user.student_id.present? ? w_user.student_id : "--"
else
w_2 = "--"
w_3 = "--"
w_3_1 = "--"
w_4 = "--"
end
course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name) course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name)
w_5 = course_name.present? ? course_name : "--" w_5 = course_name.present? ? course_name : "--"
#0 未提交, 1 按时提交, 2 延迟提交 #0 未提交, 1 按时提交, 2 延迟提交

Loading…
Cancel
Save