diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 2b8a2e118..7da7a177d 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -104,7 +104,7 @@ class HomeworkCommon < ApplicationRecord end def user_work user_id - work = self.student_works.find_by_user_id(user_id) # || StudentWork.create!(homework_common_id: id, user_id: user_id) + work = StudentWork.find_by(homework_common_id: id, user_id: user_id) || StudentWork.create!(homework_common_id: id, user_id: user_id) end # 是否在补交阶段内