Fix: Paired transactions must be updated with negative sum
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
e1de837967
commit
d101c24b85
1 changed files with 2 additions and 1 deletions
|
@ -500,7 +500,8 @@ func (c *Client) UpdateTransaction(txID uuid.UUID, tx Transaction) (err error) {
|
||||||
|
|
||||||
if err = db.Model(&Transaction{}).
|
if err = db.Model(&Transaction{}).
|
||||||
Where("pair_key = ?", oldTX.PairKey.UUID).
|
Where("pair_key = ?", oldTX.PairKey.UUID).
|
||||||
Update("amount", tx.Amount).
|
Where("id <> ?", oldTX.ID).
|
||||||
|
Update("amount", -tx.Amount).
|
||||||
Error; err != nil {
|
Error; err != nil {
|
||||||
return fmt.Errorf("updating amount for paired transaction: %w", err)
|
return fmt.Errorf("updating amount for paired transaction: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue