Browse Source

fix burger bug

latapp 9 tháng trước cách đây
mục cha
commit
550587b6a4
1 tập tin đã thay đổi với 10 bổ sung6 xóa
  1. 10 6
      routes/orders.py

+ 10 - 6
routes/orders.py

@@ -231,13 +231,17 @@ async def printer_order(order: OrderWeb, current_user: User = Depends(get_curren
 
     # Print order
     try:
-        kitchen_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type, Locations.BAR) == Locations.KITCHEN]#type: ignore
-        bar_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type, Locations.BAR) == Locations.BAR]#type: ignore
-        coctelery_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type, Locations.COCTELERY) == Locations.COCTELERY]#type: ignore
+        pizza_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type) == Locations.PIZZAS]#type: ignore
+        burger_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type) == Locations.BURGUER]#type: ignore
+        bar_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type) == Locations.BAR]#type: ignore
+        coctelery_items = [ Item(name=item.name, price=product.price, quantity=item.quantity) for product, item in zip(items, products) if CAT_ITEMS.get(item.type) == Locations.COCTELERY]#type: ignore
+        
 
-        if kitchen_items:
-            ps.print_order(Order(table=table, items=kitchen_items, customerName=user.name, totalAmount=order.totalAmount, orderDate=order.orderDate), location=Locations.KITCHEN)
-            logger.info(f"Order kitchen printed successfully for table {table}")
+        if pizza_items:
+            ps.print_order(Order(table=table, items=pizza_items, customerName=user.name, totalAmount=order.totalAmount, orderDate=order.orderDate), location=Locations.PIZZAS)
+            logger.info(f"Order pizza printed successfully for table {table}")
+        if burger_items:
+            ps.print_order(Order(table=table, items=burger_items, customerName=user.name, totalAmount=order.totalAmount, orderDate=order.orderDate), location=Locations.BURGUER)
         if bar_items:
             ps.print_order(Order(table=table, items=bar_items, customerName=user.name, totalAmount=order.totalAmount, orderDate=order.orderDate), location=Locations.BAR)
             logger.info(f"Order bar printed successfully for table {table}")