|
|
|
@ -44,9 +44,12 @@ 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)
|
|
|
|
|
group_id = params[:exercise_group_id]
|
|
|
|
|
if @exercise.blank?
|
|
|
|
|
normal_status(-1,"试卷不存在")
|
|
|
|
|
elsif @exercise_status == 1
|
|
|
|
|
normal_status(-1,"试卷未发布")
|
|
|
|
|
else
|
|
|
|
|
@course = @exercise.course
|
|
|
|
|
default_ex_users = @exercise.all_exercise_users(current_user.id).exercise_user_committed
|
|
|
|
@ -66,7 +69,7 @@ class ZipsController < ApplicationController
|
|
|
|
|
if params[:commit_status].present? && (params[:commit_status].to_i == 1)
|
|
|
|
|
@exercise_users_list = @exercise_users_list.where(commit_status:params[:commit_status])
|
|
|
|
|
elsif params[:commit_status].present? && (params[:commit_status].to_i == 0)
|
|
|
|
|
normal_status(-1,"仅支持导出已提交的学生!")
|
|
|
|
|
normal_status(-1,"暂无用户提交!")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#可以分班选择
|
|
|
|
@ -84,7 +87,7 @@ class ZipsController < ApplicationController
|
|
|
|
|
default_ex_users_size = @ex_users&.size
|
|
|
|
|
|
|
|
|
|
if default_ex_users_size.blank? || default_ex_users_size == 0
|
|
|
|
|
normal_status(-1,"导出失败,暂时没有已提交的学生")
|
|
|
|
|
normal_status(-1,"暂无用户提交")
|
|
|
|
|
elsif default_ex_users_size > 100
|
|
|
|
|
normal_status(-2,"100")
|
|
|
|
|
end
|
|
|
|
@ -98,6 +101,8 @@ class ZipsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def load_homework
|
|
|
|
|
@homework = HomeworkCommon.find(params[:homework_common_id])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@course = @homework.course
|
|
|
|
|
##7。2 -hs新增
|
|
|
|
|
@member = @course.course_member(current_user.id)
|
|
|
|
@ -121,7 +126,7 @@ class ZipsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
student_work_sizes = @all_student_works&.size
|
|
|
|
|
if student_work_sizes.blank? || student_work_sizes == 0
|
|
|
|
|
normal_status(-1,"导出失败,暂时没有已提交的学生")
|
|
|
|
|
normal_status(-1,"暂无用户提交")
|
|
|
|
|
elsif student_work_sizes > 100
|
|
|
|
|
normal_status(-2,"100")
|
|
|
|
|
end
|
|
|
|
|