7d693ef429
Recipes imported from a video caption have no nutrition data, so the values have to be estimated. Mealie will accept anything: the fields are free-text strings, a misspelt key is dropped silently, and a whole-recipe total looks exactly like a per-serving one. The recipe page then renders whatever landed as fact. patch_recipe now validates a nutrition block first. Keys must be Mealie's own, so a number cannot vanish into "carbs". Values are normalized to bare numbers, matching how the library already stores them. Energy is checked against the macros with the Atwater factors (4/9/4 kcal per gram) and refused if it is more than 25% off, which is what catches an arithmetic slip. Nutrition is per serving, and the text import left recipeServings at 0 --- it set only the free-text recipeYield, so "4-6 personer" gave Mealie no number to divide by or scale with. import_recipe_text now also sets recipeServings, from the lower bound of a range, which is how this library already stores "10-12 personer" (recipeServings 10). patch_recipe refuses nutrition while the count is still missing, and accepts it when the same patch supplies it. verify_recipe fails an import that has no nutrition, or has values without a serving count. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>