nagasurendra commited on
Commit
00395be
·
verified ·
1 Parent(s): 209652b

Update menu.py

Browse files
Files changed (1) hide show
  1. menu.py +6 -5
menu.py CHANGED
@@ -9,8 +9,8 @@ sf = get_salesforce_connection()
9
  @menu_blueprint.route("/menu", methods=["GET", "POST"])
10
  def menu():
11
  # Get the current toggle status from the query string (False if not set)
12
- veg_selected = request.args.get("veg", "off") == "on"
13
- customized_dish_selected = request.args.get("customized_dish", "off") == "on"
14
  user_email = session.get('user_email')
15
 
16
  if not user_email:
@@ -64,11 +64,11 @@ def menu():
64
  # Merge both Menu_Item__c and Custom_Dish__c records into the ordered menu
65
  all_items = food_items + custom_dishes
66
 
67
- # Apply filtering based on toggles
68
  if veg_selected:
69
- all_items = [item for item in all_items if item.get("Veg_NonVeg__c") in ["Veg", "both"]]
70
  if customized_dish_selected:
71
- all_items = [item for item in all_items if item.get("Section__c") == "Customized dish"]
72
 
73
  # Default to all items if both toggles are off
74
  if not veg_selected and not customized_dish_selected:
@@ -131,6 +131,7 @@ def menu():
131
  first_letter=first_letter # Pass first letter to the template
132
  )
133
 
 
134
  @menu_blueprint.route('/api/addons', methods=['GET'])
135
  def get_addons():
136
  item_name = request.args.get('item_name')
 
9
  @menu_blueprint.route("/menu", methods=["GET", "POST"])
10
  def menu():
11
  # Get the current toggle status from the query string (False if not set)
12
+ veg_selected = request.args.get("veg", "off") == "on" # Check if the Veg toggle is selected
13
+ customized_dish_selected = request.args.get("customized_dish", "off") == "on" # Check if the Customized Dish toggle is selected
14
  user_email = session.get('user_email')
15
 
16
  if not user_email:
 
64
  # Merge both Menu_Item__c and Custom_Dish__c records into the ordered menu
65
  all_items = food_items + custom_dishes
66
 
67
+ # Apply filtering based on toggles (Veg and Customized Dish)
68
  if veg_selected:
69
+ all_items = [item for item in all_items if item.get("Veg_NonVeg__c") in ["Veg", "both"]] # Show only Veg items
70
  if customized_dish_selected:
71
+ all_items = [item for item in all_items if item.get("Section__c") == "Customized dish"] # Show only Customized dishes
72
 
73
  # Default to all items if both toggles are off
74
  if not veg_selected and not customized_dish_selected:
 
131
  first_letter=first_letter # Pass first letter to the template
132
  )
133
 
134
+
135
  @menu_blueprint.route('/api/addons', methods=['GET'])
136
  def get_addons():
137
  item_name = request.args.get('item_name')