|
|
@ -6,9 +6,11 @@ class ZipsController < ApplicationController
|
|
|
|
before_action :require_admin_or_teacher
|
|
|
|
before_action :require_admin_or_teacher
|
|
|
|
|
|
|
|
|
|
|
|
def shixun_report
|
|
|
|
def shixun_report
|
|
|
|
student_work_ids = Array.wrap(params[:student_work_ids])
|
|
|
|
# student_work_ids = Array.wrap(params[:student_work_ids])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# service = BatchExportShixunReportService.new(@homework, @student_work_ids)
|
|
|
|
|
|
|
|
service = BatchExportShixunReportService.new(@homework, @all_student_works)
|
|
|
|
|
|
|
|
|
|
|
|
service = BatchExportShixunReportService.new(@homework, student_work_ids)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filename = filename_for_content_disposition(service.filename)
|
|
|
|
filename = filename_for_content_disposition(service.filename)
|
|
|
|
send_file service.zip, filename: filename, type: 'application/zip'
|
|
|
|
send_file service.zip, filename: filename, type: 'application/zip'
|
|
|
@ -57,9 +59,9 @@ class ZipsController < ApplicationController
|
|
|
|
@ex_users = @ex_users.where(user_id: user_ids)
|
|
|
|
@ex_users = @ex_users.where(user_id: user_ids)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
default_ex_users_size = @ex_users.size
|
|
|
|
default_ex_users_size = @ex_users&.size
|
|
|
|
|
|
|
|
|
|
|
|
if default_ex_users_size == 0
|
|
|
|
if default_ex_users_size.blank? || default_ex_users_size == 0
|
|
|
|
normal_status(-1,"导出失败,暂时没有已提交的学生")
|
|
|
|
normal_status(-1,"导出失败,暂时没有已提交的学生")
|
|
|
|
elsif default_ex_users_size > 100
|
|
|
|
elsif default_ex_users_size > 100
|
|
|
|
normal_status(-2,"100")
|
|
|
|
normal_status(-2,"100")
|
|
|
@ -75,5 +77,14 @@ class ZipsController < ApplicationController
|
|
|
|
def load_homework
|
|
|
|
def load_homework
|
|
|
|
@homework = HomeworkCommon.find(params[:homework_common_id])
|
|
|
|
@homework = HomeworkCommon.find(params[:homework_common_id])
|
|
|
|
@course = @homework.course
|
|
|
|
@course = @homework.course
|
|
|
|
|
|
|
|
##7。2 -hs新增
|
|
|
|
|
|
|
|
@member = @course.course_member(current_user.id)
|
|
|
|
|
|
|
|
@all_student_works = @homework.teacher_works(@member)
|
|
|
|
|
|
|
|
student_work_sizes = @all_student_works&.size
|
|
|
|
|
|
|
|
if student_work_sizes.blank? || student_work_sizes == 0
|
|
|
|
|
|
|
|
normal_status(-1,"导出失败,暂时没有已提交的学生")
|
|
|
|
|
|
|
|
elsif student_work_sizes > 100
|
|
|
|
|
|
|
|
normal_status(-2,"100")
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|