geethareddy commited on
Commit
b265fec
·
verified ·
1 Parent(s): 15c74b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -49,13 +49,13 @@ def get_ingredients():
49
  preference_map = {
50
  'vegetarian': "Category__c = 'Veg'",
51
  'non-vegetarian': "Category__c = 'Non-Veg'",
52
- 'both': None # No condition to fetch all records, including "Both" category
53
  }
54
  condition = preference_map.get(dietary_preference)
55
 
56
  try:
57
  # Construct the base query
58
- soql = "SELECT Name, Image_URL__c, Category__c FROM Sector_Detail__c" # Added Category__c for debugging
59
  if condition:
60
  soql += f" WHERE {condition}"
61
  soql += " LIMIT 200"
@@ -63,7 +63,7 @@ def get_ingredients():
63
  logger.info(f"Executing SOQL query: {soql}")
64
  result = sf.query(soql)
65
  ingredients = [
66
- {"name": record['Name'], "image_url": record.get('Image_URL__c', ''), "category": record.get('Category__c', 'Unknown')}
67
  for record in result['records'] if 'Name' in record
68
  ]
69
  logger.info(f"Fetched {len(ingredients)} ingredients: {ingredients}")
 
49
  preference_map = {
50
  'vegetarian': "Category__c = 'Veg'",
51
  'non-vegetarian': "Category__c = 'Non-Veg'",
52
+ 'both': None # No condition to fetch all records
53
  }
54
  condition = preference_map.get(dietary_preference)
55
 
56
  try:
57
  # Construct the base query
58
+ soql = "SELECT Name, Image_URL__c FROM Sector_Detail__c"
59
  if condition:
60
  soql += f" WHERE {condition}"
61
  soql += " LIMIT 200"
 
63
  logger.info(f"Executing SOQL query: {soql}")
64
  result = sf.query(soql)
65
  ingredients = [
66
+ {"name": record['Name'], "image_url": record.get('Image_URL__c', '')}
67
  for record in result['records'] if 'Name' in record
68
  ]
69
  logger.info(f"Fetched {len(ingredients)} ingredients: {ingredients}")