|
|
|
@ -6,12 +6,9 @@ class ZipsController < ApplicationController
|
|
|
|
|
before_action :require_admin_or_teacher
|
|
|
|
|
|
|
|
|
|
def shixun_report
|
|
|
|
|
# student_work_ids = Array.wrap(params[:student_work_ids])
|
|
|
|
|
|
|
|
|
|
# service = BatchExportShixunReportService.new(@homework, @student_work_ids)
|
|
|
|
|
service = BatchExportShixunReportService.new(@homework, @all_student_works)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filename = filename_for_content_disposition(service.filename)
|
|
|
|
|
send_file service.zip, filename: filename, type: 'application/zip'
|
|
|
|
|
rescue BatchExportShixunReportService::Error => ex
|
|
|
|
@ -23,8 +20,8 @@ class ZipsController < ApplicationController
|
|
|
|
|
exercises = ExportExercisesService.new(@exercise,@ex_users,@request_url)
|
|
|
|
|
|
|
|
|
|
file_name = filename_for_content_disposition(exercises.filename)
|
|
|
|
|
send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
|
|
|
|
|
|
|
|
|
|
send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
normal_status(-1, e.message)
|
|
|
|
|
end
|
|
|
|
@ -44,7 +41,7 @@ class ZipsController < ApplicationController
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
@exercise = Exercise.includes(:exercise_users,:exercise_questions).find_by(id:params[:exercise_id])
|
|
|
|
|
@exercise_status = @exercise.get_exercise_status(current_user.id)
|
|
|
|
|
@exercise_status = @exercise.present? ? @exercise.get_exercise_status(current_user.id) : 1
|
|
|
|
|
group_id = params[:exercise_group_id]
|
|
|
|
|
if @exercise.blank?
|
|
|
|
|
normal_status(-1,"试卷不存在")
|
|
|
|
@ -101,11 +98,16 @@ class ZipsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def load_homework
|
|
|
|
|
@homework = HomeworkCommon.find(params[:homework_common_id])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@homework_status = @homework.present? ? @homework.homework_detail_manual.comment_status : 0
|
|
|
|
|
if @homework.blank?
|
|
|
|
|
normal_status(-1,"该作业不存在")
|
|
|
|
|
elsif @homework_status == 0
|
|
|
|
|
normal_status(-1,"该作业未发布")
|
|
|
|
|
else
|
|
|
|
|
@course = @homework.course
|
|
|
|
|
##7。2 -hs新增
|
|
|
|
|
@member = @course.course_member(current_user.id)
|
|
|
|
|
|
|
|
|
|
@all_student_works = @homework.teacher_works(@member).where("work_status > 0")
|
|
|
|
|
work_status = params[:work_status]
|
|
|
|
|
group_id = params[:course_group]
|
|
|
|
@ -132,3 +134,4 @@ class ZipsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|