Feature #682
openRecipes: ingredient quantities are per batch, not per portion
0%
Description
A cook can say "8 kg of rice for a batch of 100 dosas" with confidence; nobody can reliably say "0.08 kg for one" -- and several of this hospitals own recipes had already been entered that way, landing at absurd per-portion costs (Masala Dosa at Rs 50.40, one plate of sambar at Rs 252, one cup of tea at Rs 600).
Changed RecipeCostCalculator.CostPerPortion to take batchYield and divide: cost is now sum(ingredient qty x rate) / BatchYield, with every ingredient quantity meaning the whole batch. Updated all 3 call sites (RecipeService, MenuService, ProductionPlanService), the demo seeder (ingredient quantities scaled up by each recipes own yield so seeded costs are unchanged -- Idli still 10.56, Kheer still 12.58), and the frontend BOM editor + its live cost preview, with the Qty/Line cost columns relabeled "for the whole batch"/"Batch cost" so the field cannot be misread as per-portion again.
Migrated every existing non-archived recipe_ingredient row in the local dev DB (clinq_local_s1) by multiplying its quantity by its recipes batch yield -- an identity transform that leaves every currently-displayed cost unchanged (verified live: Dhosha still 4.48, Idli still 10.56, Kheer still 7.38, all the others bit-for-bit the same). This does not fix the handful of recipes that were already wrong (Masala Dosa, sambar, tea, the Playwright test fixtures) -- out of scope here, same numbers before and after.
Updated CLAUDE.md with the new formula. Full backend suite green except the 2 pre-existing, unrelated coupon-liability failures; full frontend suite green.
No data to display