add try except
This commit is contained in:
@@ -463,8 +463,12 @@ class Home:
|
|||||||
|
|
||||||
def add_products(self, products):
|
def add_products(self, products):
|
||||||
for product in products:
|
for product in products:
|
||||||
|
try:
|
||||||
|
price = f"{round(float(product['price']) - float(product['price'])*float(product['discount'])/100,2)}"
|
||||||
|
except:
|
||||||
|
price = ''
|
||||||
self.new_price = ft.Text(
|
self.new_price = ft.Text(
|
||||||
value=f"{round(float(product['price']) - float(product['price'])*float(product['discount'])/100,2)}",
|
value= price,
|
||||||
size=14 if product['discount'] != 0 else 12,
|
size=14 if product['discount'] != 0 else 12,
|
||||||
color=ft.Colors.RED if product['discount'] != 0 else ft.Colors.BLACK,
|
color=ft.Colors.RED if product['discount'] != 0 else ft.Colors.BLACK,
|
||||||
weight=ft.FontWeight.BOLD
|
weight=ft.FontWeight.BOLD
|
||||||
|
|||||||
Reference in New Issue
Block a user