3c-fix: wrapper passes defaulted portions to core

completeCookingSession now forwards actualPortionsEaten and
leftoverEstimatePortions (after applying wrapper defaults) into
completeCookingSessionCore, so API callers omitting leftovers get
correct 100% deduction when mealBoxPortions is provided instead of
core's fallback to 0. Added regression test with leftovers omitted.
This commit is contained in:
Sven (AAMOS AI)
2026-08-07 15:51:02 +07:00
parent 0078084a2b
commit c1ab2c8f37
2 changed files with 95 additions and 1 deletions
+7 -1
View File
@@ -97,7 +97,13 @@ export async function completeCookingSession(
app,
session,
userId,
{ ...input, portionsCooked: plannedPortions, mealBoxPortions },
{
...input,
portionsCooked: plannedPortions,
mealBoxPortions,
actualPortionsEaten,
leftoverEstimatePortions,
},
correlationId,
);