Spaces:
Sleeping
Sleeping
Update menu.py
Browse files
menu.py
CHANGED
|
@@ -36,9 +36,21 @@ def get_valid_video_path(item_name, video_url=None):
|
|
| 36 |
|
| 37 |
@menu_blueprint.route("/menu", methods=["GET", "POST"])
|
| 38 |
def menu():
|
| 39 |
-
#
|
| 40 |
-
|
| 41 |
is_veg = request.args.get("veg") == "on"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
is_custom = selected_category == "Customized Dish"
|
| 43 |
is_non_veg = selected_category == "Non veg"
|
| 44 |
|
|
@@ -70,7 +82,7 @@ def menu():
|
|
| 70 |
cart_count_result = sf.query(cart_query)
|
| 71 |
cart_item_count = cart_count_result.get('totalSize', 0)
|
| 72 |
|
| 73 |
-
#
|
| 74 |
menu_query = """
|
| 75 |
SELECT Name, Price__c, Description__c, Image1__c, Image2__c,
|
| 76 |
Veg_NonVeg__c, Section__c, Total_Ordered__c, Video1__c,
|
|
@@ -122,7 +134,7 @@ def menu():
|
|
| 122 |
best_sellers = [item for item in best_sellers if not item['is_menu_item']]
|
| 123 |
ordered_menu["Best Sellers"] = best_sellers[:4]
|
| 124 |
|
| 125 |
-
# Organize
|
| 126 |
added_item_names = set()
|
| 127 |
for item in all_items:
|
| 128 |
section = item['Section__c']
|
|
|
|
| 36 |
|
| 37 |
@menu_blueprint.route("/menu", methods=["GET", "POST"])
|
| 38 |
def menu():
|
| 39 |
+
# Get raw query params
|
| 40 |
+
category_param = request.args.get("category", "All")
|
| 41 |
is_veg = request.args.get("veg") == "on"
|
| 42 |
+
|
| 43 |
+
# Priority logic for setting selected_category
|
| 44 |
+
if category_param == "Customized Dish":
|
| 45 |
+
selected_category = "Customized Dish"
|
| 46 |
+
elif is_veg:
|
| 47 |
+
selected_category = "Veg"
|
| 48 |
+
elif category_param == "Non veg":
|
| 49 |
+
selected_category = "Non veg"
|
| 50 |
+
else:
|
| 51 |
+
selected_category = "All"
|
| 52 |
+
|
| 53 |
+
# Boolean flags to pass to template
|
| 54 |
is_custom = selected_category == "Customized Dish"
|
| 55 |
is_non_veg = selected_category == "Non veg"
|
| 56 |
|
|
|
|
| 82 |
cart_count_result = sf.query(cart_query)
|
| 83 |
cart_item_count = cart_count_result.get('totalSize', 0)
|
| 84 |
|
| 85 |
+
# Query menu items
|
| 86 |
menu_query = """
|
| 87 |
SELECT Name, Price__c, Description__c, Image1__c, Image2__c,
|
| 88 |
Veg_NonVeg__c, Section__c, Total_Ordered__c, Video1__c,
|
|
|
|
| 134 |
best_sellers = [item for item in best_sellers if not item['is_menu_item']]
|
| 135 |
ordered_menu["Best Sellers"] = best_sellers[:4]
|
| 136 |
|
| 137 |
+
# Organize into sections
|
| 138 |
added_item_names = set()
|
| 139 |
for item in all_items:
|
| 140 |
section = item['Section__c']
|