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:
@@ -97,7 +97,13 @@ export async function completeCookingSession(
|
||||
app,
|
||||
session,
|
||||
userId,
|
||||
{ ...input, portionsCooked: plannedPortions, mealBoxPortions },
|
||||
{
|
||||
...input,
|
||||
portionsCooked: plannedPortions,
|
||||
mealBoxPortions,
|
||||
actualPortionsEaten,
|
||||
leftoverEstimatePortions,
|
||||
},
|
||||
correlationId,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user