lokesh341 commited on
Commit
0f2f884
·
verified ·
1 Parent(s): 3f862cb

Update menu.py

Browse files
Files changed (1) hide show
  1. menu.py +8 -10
menu.py CHANGED
@@ -67,10 +67,11 @@ def menu():
67
  cart_count_result = sf.query(cart_query)
68
  cart_item_count = cart_count_result.get('totalSize', 0)
69
 
70
- # Fetch all Menu_Item__c records with only existing fields
71
  menu_query = """
72
  SELECT Name, Price__c, Description__c, Image1__c, Image2__c,
73
- Veg_NonVeg__c, Section__c, Total_Ordered__c, Video1__c
 
74
  FROM Menu_Item__c
75
  """
76
  menu_result = sf.query_all(menu_query)
@@ -82,10 +83,10 @@ def menu():
82
  item['Video1__c'] = get_valid_video_path(item['Name'], item.get('Video1__c'))
83
  item['Section__c'] = item.get('Section__c', "Others")
84
  item['Description__c'] = item.get('Description__c', "No description available")
85
- # Add default values for missing fields
86
- item['IngredientsInfo__c'] = "Not specified"
87
- item['NutritionalInfo__c'] = "Not available"
88
- item['Allergens__c'] = "None listed"
89
 
90
  # Fetch all Custom_Dish__c records with only existing fields
91
  custom_dish_query = """
@@ -103,10 +104,7 @@ def menu():
103
  item['Video1__c'] = get_valid_video_path(item['Name'])
104
  item['Section__c'] = item.get('Section__c', "Customized dish")
105
  item['Description__c'] = item.get('Description__c', "No description available")
106
- # Add default values for missing fields
107
- item['IngredientsInfo__c'] = "Not specified"
108
- item['NutritionalInfo__c'] = "Not available"
109
- item['Allergens__c'] = "None listed"
110
 
111
  # Merge all items
112
  all_items = food_items + custom_dishes
 
67
  cart_count_result = sf.query(cart_query)
68
  cart_item_count = cart_count_result.get('totalSize', 0)
69
 
70
+ # Fetch all Menu_Item__c records with required fields
71
  menu_query = """
72
  SELECT Name, Price__c, Description__c, Image1__c, Image2__c,
73
+ Veg_NonVeg__c, Section__c, Total_Ordered__c, Video1__c,
74
+ IngredientsInfo__c, NutritionalInfo__c, Allergens__c
75
  FROM Menu_Item__c
76
  """
77
  menu_result = sf.query_all(menu_query)
 
83
  item['Video1__c'] = get_valid_video_path(item['Name'], item.get('Video1__c'))
84
  item['Section__c'] = item.get('Section__c', "Others")
85
  item['Description__c'] = item.get('Description__c', "No description available")
86
+ item['IngredientsInfo__c'] = item.get('IngredientsInfo__c', "Not specified")
87
+ item['NutritionalInfo__c'] = item.get('NutritionalInfo__c', "Not available")
88
+ item['Allergens__c'] = item.get('Allergens__c', "None listed")
89
+ item['is_menu_item'] = True # Flag to identify Menu_Item__c records
90
 
91
  # Fetch all Custom_Dish__c records with only existing fields
92
  custom_dish_query = """
 
104
  item['Video1__c'] = get_valid_video_path(item['Name'])
105
  item['Section__c'] = item.get('Section__c', "Customized dish")
106
  item['Description__c'] = item.get('Description__c', "No description available")
107
+ item['is_menu_item'] = False # Flag to identify Custom_Dish__c records
 
 
 
108
 
109
  # Merge all items
110
  all_items = food_items + custom_dishes