Skip to content
Snippets Groups Projects
Commit 4ce58eb5 authored by meskio's avatar meskio :tent:
Browse files

Save order purchase on update

parent 0afaf564
Branches
Tags
No related merge requests found
......@@ -173,6 +173,13 @@ func (d *DB) updateOrderPurchase(memberNum int, transaction *Transaction, total
if err != nil {
return err
}
for _, p := range transaction.OrderPurchase {
err = tx.Save(&p).Error
if err != nil {
return err
}
}
return tx.Save(&transaction).Error
})
}
......
......@@ -401,6 +401,9 @@ func TestUpdateOrderPurchase(t *testing.T) {
if transactions[0].Total != -total {
t.Fatal("Wrong total", transactions[0].Total)
}
if transactions[0].OrderPurchase[0].Amount != 2 {
t.Fatal("Wrong amount", transactions[0].OrderPurchase)
}
resp = tapi.do("GET", "/order/active", nil, &orders)
if resp.StatusCode != http.StatusOK {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment