fix(planner): correct set_size to 3 dinners and switch cost filter to per-serving

- set_size 21→3, top_k 20→10: generate 3 weekly dinners not full 3×7 matrix
- All 3 items assigned MealType.DINNER on Mon/Wed/Fri
- RecipeCost gains servings field + cost_per_serving property
- compute_recipe_cost accepts servings param (default 4)
- filter.py gates on cost_per_serving instead of total_cost
- max_meal_cost 500→50 (now a meaningful $/serving threshold)
- Email displays ~$X/serving instead of inflated raw total
- select_set: candidate_pool uses max(top_k, set_size) to prevent
  combinations(n<set_size) returning empty iterator

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 07:20:17 -07:00
co-authored by Claude Sonnet 4.6
parent 16069bfa92
commit 35f736a052
7 changed files with 27 additions and 13 deletions
+2
View File
@@ -43,6 +43,7 @@ def compute_recipe_cost(
ingredients: Iterable[dict],
match_index: Dict[UUID, List[dict]],
pantry_ingredient_ids: Set[UUID],
servings: int = 4,
) -> RecipeCost:
line_items: List[IngredientCost] = []
total_cost = Decimal("0.00")
@@ -119,5 +120,6 @@ def compute_recipe_cost(
matched_ingredient_count=matched_count,
total_ingredient_count=total,
pantry_hit_count=pantry_hits,
servings=max(servings, 1),
line_items=line_items,
)