accept and use custom settle value
This commit is contained in:
@@ -12,8 +12,8 @@ class Homie < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def settle
|
||||
total = MoneyMove.where(homie_id: id).all.sum(:amount)
|
||||
def settle(amount)
|
||||
total = amount.nil? ? MoneyMove.where(homie_id: id).all.sum(:amount) : amount
|
||||
all_money_moves = MoneyMove.where(homie_id: id).all
|
||||
|
||||
transaction do
|
||||
@@ -22,7 +22,7 @@ class Homie < ApplicationRecord
|
||||
MoneyMove.create_settle_record(id, total)
|
||||
end
|
||||
true
|
||||
rescue StandardError => e
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user