From 28952402aa921f4cf5cb969fe0b952a07492b26a Mon Sep 17 00:00:00 2001 From: tanshu Date: Wed, 16 Dec 2020 12:28:39 +0530 Subject: [PATCH] Fix: Loaded voucher was not showing H H name in Happy Hour products --- barker/barker/routers/voucher/show.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/barker/barker/routers/voucher/show.py b/barker/barker/routers/voucher/show.py index a7e49cc..a4dd8e1 100644 --- a/barker/barker/routers/voucher/show.py +++ b/barker/barker/routers/voucher/show.py @@ -97,7 +97,7 @@ def from_table( return voucher_blank(table, guest) -def voucher_product(product_id: uuid.UUID, date_: date, db: Session): +def voucher_product(product_id: uuid.UUID, date_: date, is_happy_hour: bool, db: Session): product: ProductVersion = ( db.query(ProductVersion) .filter( @@ -118,7 +118,7 @@ def voucher_product(product_id: uuid.UUID, date_: date, db: Session): return { "id": product_id, - "name": product.full_name, + "name": ("H H " if is_happy_hour else "") + product.full_name, "menuCategory": { "id": product.menu_category_id, "name": product.menu_category.name, @@ -160,7 +160,7 @@ def voucher_info(item: Voucher, db: Session): { "id": i.id, "sortOrder": i.sort_order, - "product": voucher_product(i.product_id, item.date.date(), db), + "product": voucher_product(i.product_id, item.date.date(), i.is_happy_hour, db), "quantity": i.quantity, "price": i.price, "isHappyHour": i.is_happy_hour,