|
|
|
@ -20,6 +20,7 @@ class ZipsController < ApplicationController
|
|
|
|
|
exercises = ExportExercisesService.new(@exercise,@ex_users)
|
|
|
|
|
|
|
|
|
|
file_name = filename_for_content_disposition(exercises.filename)
|
|
|
|
|
logger.info("##################_______________________file_name_____________________############{file_name}")
|
|
|
|
|
send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
normal_status(-1, e.message)
|
|
|
|
@ -39,14 +40,14 @@ class ZipsController < ApplicationController
|
|
|
|
|
def get_exercise
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
@exercise = Exercise.find_by(id:params[:exercise_id])
|
|
|
|
|
@exercise = Exercise.includes(:exercise_users).find_by(id:params[:exercise_id])
|
|
|
|
|
group_id = params[:exercise_group_id]
|
|
|
|
|
if @exercise.blank?
|
|
|
|
|
normal_status(-1,"试卷不存在")
|
|
|
|
|
else
|
|
|
|
|
@course = @exercise.course
|
|
|
|
|
|
|
|
|
|
default_ex_users = @exercise.all_exercise_users(current_user.id).exercise_user_committed.limit 2
|
|
|
|
|
default_ex_users = @exercise.all_exercise_users(current_user.id).exercise_user_committed
|
|
|
|
|
default_ex_users_size = default_ex_users.size
|
|
|
|
|
@ex_users = default_ex_users #仅导出已提交的,截止后则是全部为提交的。
|
|
|
|
|
#可以分班选择
|
|
|
|
|