nagasurendra commited on
Commit
af99d7c
·
verified ·
1 Parent(s): e89028e

Update menu.py

Browse files
Files changed (1) hide show
  1. menu.py +7 -3
menu.py CHANGED
@@ -12,10 +12,13 @@ def menu():
12
 
13
  # Check if the "Veg" toggle is on
14
  is_veg_only = request.args.get("veg") == 'on' # Veg toggle on
15
-
16
- if is_veg_only:
 
 
 
17
  selected_category = "Veg" # If the veg toggle is on, show only Veg items
18
- elif selected_category != "Customized Dish":
19
  selected_category = "All" # Default to All if Veg toggle is off and Customized Dish is not selected
20
 
21
  user_email = session.get('user_email')
@@ -78,6 +81,7 @@ def menu():
78
  # Sort items by Total_Ordered__c in descending order and pick top 4 as best sellers
79
  best_sellers = sorted(all_items, key=lambda x: x.get("Total_Ordered__c", 0), reverse=True)
80
 
 
81
  if selected_category == "Veg":
82
  best_sellers = [item for item in best_sellers if item.get("Veg_NonVeg__c") in ["Veg", "both"]]
83
  elif selected_category == "Non veg":
 
12
 
13
  # Check if the "Veg" toggle is on
14
  is_veg_only = request.args.get("veg") == 'on' # Veg toggle on
15
+
16
+ # If Customized Dish toggle is on, set selected category to "Customized Dish"
17
+ if request.args.get("category") == "Customized Dish":
18
+ selected_category = "Customized Dish"
19
+ elif is_veg_only:
20
  selected_category = "Veg" # If the veg toggle is on, show only Veg items
21
+ else:
22
  selected_category = "All" # Default to All if Veg toggle is off and Customized Dish is not selected
23
 
24
  user_email = session.get('user_email')
 
81
  # Sort items by Total_Ordered__c in descending order and pick top 4 as best sellers
82
  best_sellers = sorted(all_items, key=lambda x: x.get("Total_Ordered__c", 0), reverse=True)
83
 
84
+ # If the category is "Veg", filter for Veg items
85
  if selected_category == "Veg":
86
  best_sellers = [item for item in best_sellers if item.get("Veg_NonVeg__c") in ["Veg", "both"]]
87
  elif selected_category == "Non veg":