nagasurendra commited on
Commit
67666ca
·
verified ·
1 Parent(s): 2bc942c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -39,11 +39,14 @@ def get_ingredients():
39
  logging.debug(f"Received dietary preference: {dietary_preference}")
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
 
48
  if not condition:
49
  logging.debug("Invalid dietary preference received.")
@@ -62,6 +65,7 @@ def get_ingredients():
62
  logging.error(f"Error while fetching ingredients: {str(e)}")
63
  return jsonify({"error": f"Failed to fetch ingredients: {str(e)}"}), 500
64
 
 
65
  @app.route('/get_menu_items', methods=['POST'])
66
  def get_menu_items():
67
  ingredient_names = request.json.get('ingredient_names', '').strip().lower()
 
39
  logging.debug(f"Received dietary preference: {dietary_preference}")
40
 
41
  # Map dietary preference to SOQL condition
42
+ if dietary_preference == 'both':
43
+ condition = "Category__c = 'both'" # This will fetch both vegetarian and non-vegetarian
44
+ else:
45
+ preference_map = {
46
+ 'vegetarian': "Category__c = 'Veg'",
47
+ 'non-vegetarian': "Category__c = 'Non-Veg'"
48
+ }
49
+ condition = preference_map.get(dietary_preference)
50
 
51
  if not condition:
52
  logging.debug("Invalid dietary preference received.")
 
65
  logging.error(f"Error while fetching ingredients: {str(e)}")
66
  return jsonify({"error": f"Failed to fetch ingredients: {str(e)}"}), 500
67
 
68
+
69
  @app.route('/get_menu_items', methods=['POST'])
70
  def get_menu_items():
71
  ingredient_names = request.json.get('ingredient_names', '').strip().lower()