Fix issue with updating expense value for the same card
This commit is contained in:
parent
ead0a4bd60
commit
b9cfa2004a
|
@ -85,7 +85,7 @@ func (e *Expense) BeforeUpdate(tx *gorm.DB) (err error) {
|
||||||
if oldCard.UserID != e.UserID {
|
if oldCard.UserID != e.UserID {
|
||||||
return ERROR_EXPENSE_INVALID_USERID
|
return ERROR_EXPENSE_INVALID_USERID
|
||||||
}
|
}
|
||||||
oldCard.Balance += e.Value
|
oldCard.Balance += original.Value
|
||||||
if err := tx.Save(oldCard).Error; err != nil {
|
if err := tx.Save(oldCard).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user