Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Rectify issues with mismatched types float64 and int

Katos0a72fa95b3a0
diff --git a/backend/app/api/handlers/v1/v1_ctrl_locations.go b/backend/app/api/handlers/v1/v1_ctrl_locations.go
index a2498ec1..8bd403bc 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_locations.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_locations.go
@@ -99,8 +99,9 @@ func (ctrl *V1Controller) GetLocationWithPrice(auth context.Context, GID uuid.UU
}
for _, item := range items.Items {
- // Include quantity in the calculation
- itemTotal := big.NewInt(int64(item.PurchasePrice * item.Quantity * 100))
+ // Convert item.Quantity to float64 for multiplication
+ quantity := float64(item.Quantity)
+ itemTotal := big.NewInt(int64(item.PurchasePrice * quantity * 100))
totalPrice.Add(totalPrice, itemTotal)
}