portionBatch
Split a cooked batch into per-eater portions sized by remaining needs, fixed grams, macro targets, or reserves, returning exact weights, macros, and the deciding rule.
Instructions
Split a cooked batch into portions that are sized per eater rather than divided equally. Each portion carries its own rule: solve for what an eater still needs today, take a fixed weight, hit a macro target, take the remainder, or set food aside for later. Returns each portion's weight and macros, which constraint decided the weight, and where the other targets landed. Asking for more than the batch holds is an error, never a silent scale-down. Weights are rounded to the gram for reporting, so adding up the portions can differ from the batch by a gram; allocatedG and leftoverG carry the exact figures.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eaters | No | Required for solveForRemaining. When given, every portion also reports how it lands against that eater's remaining targets. | |
| portions | Yes | ||
| cookedBasis | No | Defaults to measured. 'estimated' means the cooked weight came from a yield table, which caps the confidence of every portion at medium. | |
| totalMacros | Yes | Macros of the whole cooked batch. | |
| totalCookedG | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| byEater | Yes | ||
| portions | Yes | ||
| warnings | Yes | ||
| leftoverG | Yes | Zero whenever one of the rules is 'remainder'. | |
| allocatedG | Yes | ||
| per100gCooked | Yes | ||
| leftoverMacros | Yes |