Yaswanth56 commited on
Commit
5f420b7
·
verified ·
1 Parent(s): 3cd3487

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -40,8 +40,8 @@ def get_ingredients():
40
 
41
  # Map dietary preference to SOQL condition
42
  preference_map = {
43
- 'vegetarian': "Category__c = 'Veg'",
44
- 'non-vegetarian': "Category__c = 'Non-Veg'"
45
  }
46
  condition = preference_map.get(dietary_preference)
47
 
@@ -53,10 +53,10 @@ def get_ingredients():
53
  soql = f"SELECT Name FROM Sector_Detail__c WHERE {condition} LIMIT 200"
54
  result = sf.query(soql)
55
  ingredients = [
56
- {"name": record['Name'], "image_url": "https://via.placeholder.com/80"} # Default image URL
57
  for record in result['records'] if 'Name' in record
58
  ]
59
- logging.debug(f"Fetched {len(ingredients)} ingredients.")
60
  return jsonify({"ingredients": ingredients})
61
  except Exception as e:
62
  logging.error(f"Error while fetching ingredients: {str(e)}")
@@ -89,7 +89,7 @@ def get_menu_items():
89
  }
90
  for record in result['records'] if 'Name' in record
91
  ]
92
- logging.debug(f"Fetched {len(menu_items)} menu items.")
93
  return jsonify({"menu_items": menu_items})
94
  except Exception as e:
95
  logging.error(f"Error while fetching menu items: {str(e)}")
 
40
 
41
  # Map dietary preference to SOQL condition
42
  preference_map = {
43
+ 'vegetarian': "Veg_NonVeg__c = 'Veg'", # Updated to match picklist field name if different
44
+ 'non-vegetarian': "Veg_NonVeg__c = 'Non-Veg'"
45
  }
46
  condition = preference_map.get(dietary_preference)
47
 
 
53
  soql = f"SELECT Name FROM Sector_Detail__c WHERE {condition} LIMIT 200"
54
  result = sf.query(soql)
55
  ingredients = [
56
+ {"name": record['Name'], "image_url": "https://picsum.photos/80"} # Changed to picsum for testing
57
  for record in result['records'] if 'Name' in record
58
  ]
59
+ logging.debug(f"Fetched ingredients: {ingredients}")
60
  return jsonify({"ingredients": ingredients})
61
  except Exception as e:
62
  logging.error(f"Error while fetching ingredients: {str(e)}")
 
89
  }
90
  for record in result['records'] if 'Name' in record
91
  ]
92
+ logging.debug(f"Fetched menu items: {menu_items}")
93
  return jsonify({"menu_items": menu_items})
94
  except Exception as e:
95
  logging.error(f"Error while fetching menu items: {str(e)}")