food diary bug fix, blocking calorie count

This commit is contained in:
Joren de Graaf
2026-10-18 00:03:47 +02:00
parent e3b14d6823
commit a8418cdba7
8 changed files with 150 additions and 41 deletions
+3 -2
View File
@@ -344,9 +344,10 @@ def create_server() -> MCPServer:
'protein_g': 'protein_goal_g', 'fat_g': 'fat_goal_g', 'fibre_g': 'fibre_goal_g'}
remaining = {name: str(Decimal(goals[goal]) - Decimal(data['totals'][name]))
for name, goal in mapping.items() if goals.get(goal) is not None and
data['totals'][name] is not None and not (name == 'fibre_g' and data.get('fibre_incomplete'))}
data['totals'][name] is not None and not data.get('incomplete', {}).get(name, False)}
return {'date': data['date'], 'meals': entries, 'totals': data['totals'], 'goals': goals,
'remaining': remaining, 'fibre_incomplete': data.get('fibre_incomplete', False)}
'remaining': remaining, 'incomplete': data.get('incomplete', {}),
'fibre_incomplete': data.get('fibre_incomplete', False)}
@server.tool(structured_output=True, description='Search the authenticated user’s saved TaskNest food products before logging a known food. Returns serving sizes, portions, and nutrition per 100 g/ml. Does not change data.')
async def food_search_products(query: str, limit: int = 20) -> dict[str, Any]: