Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 53 |
}
|
| 54 |
condition = preference_map.get(dietary_preference)
|
| 55 |
|
| 56 |
try:
|
| 57 |
# Construct the base query
|
| 58 |
-
soql = "SELECT Name, Image_URL__c
|
| 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', '')
|
| 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}")
|