From b9cfa2004a2c50ecdc458185be2c298b1ba06cc8 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Mon, 18 Nov 2024 19:07:11 +0200 Subject: [PATCH] Fix issue with updating expense value for the same card --- db/expense.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/expense.go b/db/expense.go index 5ea3184..24651bd 100644 --- a/db/expense.go +++ b/db/expense.go @@ -85,7 +85,7 @@ func (e *Expense) BeforeUpdate(tx *gorm.DB) (err error) { if oldCard.UserID != e.UserID { return ERROR_EXPENSE_INVALID_USERID } - oldCard.Balance += e.Value + oldCard.Balance += original.Value if err := tx.Save(oldCard).Error; err != nil { return err }