should be item qty
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m17s

This commit is contained in:
matst80
2024-11-15 10:34:49 +01:00
parent 85d2a0a572
commit dd7f599c24

View File

@@ -294,7 +294,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
for i, item := range c.Items { for i, item := range c.Items {
if item.Id == int(msg.Id) { if item.Id == int(msg.Id) {
if msg.Quantity <= 0 { if msg.Quantity <= 0 {
c.TotalPrice -= item.Price * int64(msg.Quantity) c.TotalPrice -= item.Price * int64(item.Quantity)
c.Items = append(c.Items[:i], c.Items[i+1:]...) c.Items = append(c.Items[:i], c.Items[i+1:]...)
} else { } else {
diff := int(msg.Quantity) - item.Quantity diff := int(msg.Quantity) - item.Quantity