nagasurendra commited on
Commit
de73c87
·
verified ·
1 Parent(s): 76bfd3d

Update menu.py

Browse files
Files changed (1) hide show
  1. menu.py +5 -15
menu.py CHANGED
@@ -36,20 +36,11 @@ def get_valid_video_path(item_name, video_url=None):
36
 
37
  @menu_blueprint.route("/menu", methods=["GET", "POST"])
38
  def menu():
39
- selected_category = "All"
 
40
  is_veg = request.args.get("veg") == "on"
41
- is_non_veg = request.args.get("non_veg") == "on"
42
- is_custom = request.args.get("custom") == "on"
43
-
44
- # Determine category based on toggles
45
- if is_custom:
46
- selected_category = "Customized Dish"
47
- elif is_veg and not is_non_veg:
48
- selected_category = "Veg"
49
- elif is_non_veg and not is_veg:
50
- selected_category = "Non veg"
51
- else:
52
- selected_category = "All"
53
 
54
  user_email = session.get('user_email')
55
  if not user_email:
@@ -118,6 +109,7 @@ def menu():
118
 
119
  # Merge all items
120
  all_items = food_items + custom_dishes
 
121
  ordered_menu = {section: [] for section in SECTION_ORDER}
122
 
123
  # Best Sellers
@@ -147,8 +139,6 @@ def menu():
147
  continue
148
  if selected_category == "Customized Dish" and item['is_menu_item']:
149
  continue
150
- if selected_category == "All" and not item:
151
- continue
152
 
153
  ordered_menu[section].append(item)
154
  added_item_names.add(item['Name'])
 
36
 
37
  @menu_blueprint.route("/menu", methods=["GET", "POST"])
38
  def menu():
39
+ # Correct filter selection logic
40
+ selected_category = request.args.get("category", "All")
41
  is_veg = request.args.get("veg") == "on"
42
+ is_custom = selected_category == "Customized Dish"
43
+ is_non_veg = selected_category == "Non veg"
 
 
 
 
 
 
 
 
 
 
44
 
45
  user_email = session.get('user_email')
46
  if not user_email:
 
109
 
110
  # Merge all items
111
  all_items = food_items + custom_dishes
112
+ SECTION_ORDER = ["Best Sellers", "Starters", "Biryanis", "Curries", "Breads", "Customized dish", "Apetizer", "Desserts", "Soft Drinks"]
113
  ordered_menu = {section: [] for section in SECTION_ORDER}
114
 
115
  # Best Sellers
 
139
  continue
140
  if selected_category == "Customized Dish" and item['is_menu_item']:
141
  continue
 
 
142
 
143
  ordered_menu[section].append(item)
144
  added_item_names.add(item['Name'])