|
|
@ -208,11 +208,16 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
elsif @work_count == 0
|
|
|
|
elsif @work_count == 0
|
|
|
|
normal_status(-1,"暂无提交的学生!")
|
|
|
|
normal_status(-1,"暂无提交的学生!")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
student_work_to_xlsx(@work_excel,@homework)
|
|
|
|
respond_to do |format|
|
|
|
|
exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S')
|
|
|
|
format.xlsx{
|
|
|
|
|
|
|
|
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}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
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}
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif params[:format] == "zip"
|
|
|
|
elsif params[:format] == "zip"
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
@ -221,9 +226,13 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
zip_works = @work_excel.where("work_status > 0")
|
|
|
|
zip_works = @work_excel.where("work_status > 0")
|
|
|
|
status = checkfileSize(zip_works)
|
|
|
|
status = checkfileSize(zip_works)
|
|
|
|
if status == 0
|
|
|
|
if status == 0
|
|
|
|
zipfile = zip_homework_common @homework, zip_works
|
|
|
|
respond_to do |format|
|
|
|
|
file = decode64(zipfile[0][:base64file])
|
|
|
|
format.zip{
|
|
|
|
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip'
|
|
|
|
zipfile = zip_homework_common @homework, zip_works
|
|
|
|
|
|
|
|
file = decode64(zipfile[0][:base64file])
|
|
|
|
|
|
|
|
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
tip_exception(status == -2 ? "500M" : "无附件可下载")
|
|
|
|
tip_exception(status == -2 ? "500M" : "无附件可下载")
|
|
|
|
end
|
|
|
|
end
|
|
|
|