From 52aad5dcbfac54bf404d0de393cb628b9d9b14ce Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 11:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/homework_common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 # 是否在补交阶段内