|
|
|
@ -169,12 +169,8 @@ class HomeworkCommon < ApplicationRecord
|
|
|
|
|
|
|
|
|
|
#删除时更新题库中的引用数
|
|
|
|
|
def update_homework_bank_quotes
|
|
|
|
|
old_banks = self.homework_bank
|
|
|
|
|
unless old_banks.blank?
|
|
|
|
|
old_banks.each do |bank|
|
|
|
|
|
bank.update_attributes(quotes: (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0, homework_common_id: nil)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
old_bank = self.homework_bank
|
|
|
|
|
old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 查重是否有新结果
|
|
|
|
|