From e37e001b17389e3b2fe526d4b4b3bc033a69b927 Mon Sep 17 00:00:00 2001 From: Marius Robert Macamete Date: Mon, 9 Mar 2026 11:13:24 +0200 Subject: [PATCH] add try except --- UI_V2/pages/home/home.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UI_V2/pages/home/home.py b/UI_V2/pages/home/home.py index 3b166b6..c733c16 100644 --- a/UI_V2/pages/home/home.py +++ b/UI_V2/pages/home/home.py @@ -463,8 +463,12 @@ class Home: def add_products(self, 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( - value=f"{round(float(product['price']) - float(product['price'])*float(product['discount'])/100,2)}", + value= price, size=14 if product['discount'] != 0 else 12, color=ft.Colors.RED if product['discount'] != 0 else ft.Colors.BLACK, weight=ft.FontWeight.BOLD