We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 524ade1 commit 580e983Copy full SHA for 580e983
1 file changed
function-calling-tools/solution-files/products.py
@@ -48,12 +48,13 @@ def calculate_bulk_price(product_id: str, quantity: int) -> dict:
48
else:
49
discount = Decimal("0")
50
51
- unit_price = base_price * (Decimal("1") - discount)
52
- total_price = unit_price * quantity
+ unit_price = unit_price.quantize(Decimal("0.01"))
+ total_price = total_price.quantize(Decimal("0.01"))
53
+ discount_percent = (discount * 100).quantize(Decimal("0.01"))
54
55
return {
56
"quantity": quantity,
- "discount_percent": discount * 100,
57
- "unit_price": unit_price,
58
- "total_price": total_price
+ "discount_percent": str(discount_percent),
+ "unit_price": str(unit_price),
59
+ "total_price": str(total_price),
60
}
0 commit comments