Skip to content

Commit ce4be8e

Browse files
committed
Round price to decimal places
1 parent 37ece55 commit ce4be8e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

models/mysql_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def save_new_pizza(name, ingredients):
3636
Ingredient(name=ingredient["name"], vegetarian=ingredient["vegetarian"], price=ingredient["price"]))
3737
calculated_price = calculated_price + 0.4 * calculated_price # 40% profit
3838
calculated_price = calculated_price + 0.09 * calculated_price # 9% VAT
39+
calculated_price = str(round(calculated_price, 2))
3940
new_pizza = Pizza(name=name, vegetarian=veg_flag, price=calculated_price, ingredients=ingredients_list)
4041
db.session.add(new_pizza)
4142
db.session.commit()

0 commit comments

Comments
 (0)