diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index c0882ec6f..6512c3f1d 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -170,7 +170,7 @@ class HomeworkCommon < ApplicationRecord #删除时更新题库中的引用数 def update_homework_bank_quotes old_bank = self.homework_bank - old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil) + old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil) if old_bank.present? end # 查重是否有新结果