Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,8 @@ def get_ingredients():
|
|
| 40 |
|
| 41 |
# Map dietary preference to SOQL condition
|
| 42 |
preference_map = {
|
| 43 |
-
'vegetarian': "
|
| 44 |
-
'non-vegetarian': "
|
| 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://
|
| 57 |
for record in result['records'] if 'Name' in record
|
| 58 |
]
|
| 59 |
-
logging.debug(f"Fetched {
|
| 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 {
|
| 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)}")
|