|
|
@ -1402,7 +1402,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def find_or_save_student_work(is_test)
|
|
|
|
def find_or_save_student_work(is_test)
|
|
|
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
|
|
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
|
|
|
|
if student_work.nil?
|
|
|
|
if student_work.nil?
|
|
|
|
@homework.student_works.build(
|
|
|
|
@homework.student_works.build(
|
|
|
|
name: params[:title],
|
|
|
|
name: params[:title],
|
|
|
@ -1413,7 +1413,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
unless @homework.save
|
|
|
|
unless @homework.save
|
|
|
|
logger.debug @homework.errors.full_messages
|
|
|
|
logger.debug @homework.errors.full_messages
|
|
|
|
else
|
|
|
|
else
|
|
|
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
|
|
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
student_work
|
|
|
|
student_work
|
|
|
|