feat: add "round off this day" nutrition suggestions

Suggest optimal 1-3 food combinations to fill remaining macro budget using
weighted least-squares solver over a curated pantry (~55 foods) plus user
favorites/recents. Recipes scored individually (no combining). Features:

- Combinatorial solver (singles, pairs, triples) with macro-weighted scoring
- MealTypePicker component (extracted from quick-log, shared)
- Hero card with fit%, macro delta icons (Beef/Droplet/Wheat), ingredient
  cards, animated +/X toggle for logging
- Responsive layout: sidebar on mobile, center column on desktop
- MongoDB cache with ±5% tolerance, SSR on cache hit, TTL auto-expiry
- Cache invalidation on food-log/favorites/custom-meals CRUD
- Recipe per100g backfill admin endpoint
This commit is contained in:
2026-04-09 20:47:31 +02:00
parent 6029cfe18c
commit 1e23ed02c2
17 changed files with 1645 additions and 37 deletions
+4
View File
@@ -184,6 +184,10 @@ const RecipeSchema = new mongoose.Schema(
recipeRefMultiplier: { type: Number, default: 1 },
}],
// Cached nutrition per 100g (for round-off suggestions & listing)
cachedPer100g: { type: mongoose.Schema.Types.Mixed },
cachedTotalGrams: { type: Number },
// Translation metadata for tracking changes
translationMetadata: {
lastModifiedGerman: {type: Date},