mirror of
https://github.com/foomo/shop.git
synced 2026-08-12 04:30:19 +00:00
append new postions as first item to slice
This commit is contained in:
+5
-1
@@ -310,7 +310,11 @@ func (order *Order) SetPositionQuantity(itemID string, quantity float64, crossPr
|
||||
if price != -1 {
|
||||
newPos.Price = price
|
||||
}
|
||||
order.Positions = append(order.Positions, newPos)
|
||||
// append new psoitions as first item
|
||||
tmpPositions := []*Position{}
|
||||
tmpPositions = append(tmpPositions, newPos)
|
||||
tmpPositions = append(tmpPositions, order.Positions...)
|
||||
order.Positions = tmpPositions
|
||||
return order.Upsert()
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user