Fix issue with updating expense value for the same card

This commit is contained in:
qowevisa 2024-11-18 19:07:11 +02:00
parent ead0a4bd60
commit b9cfa2004a

View File

@ -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
}