fix stock consume

This commit is contained in:
c9s 2020-08-11 10:29:17 +08:00
parent 329aa39d26
commit 51700c951a

View File

@ -169,8 +169,11 @@ func (m *StockManager) consume(sell Stock) error {
delta := stock.Consume(sell.Quantity) delta := stock.Consume(sell.Quantity)
sell.Consume(delta) sell.Consume(delta)
m.Stocks[idx] = stock m.Stocks[idx] = stock
if zero(sell.Quantity) {
return nil
}
} }
if !zero(sell.Quantity) { if !zero(sell.Quantity) {