You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A menu asking for 2.5 servings puts 3 servings' worth on the shopping list #680
The server does the same: Add All to Shopping List on that menu adds 300 g of beans. The menu page itself shows the line at ×2.5 and links to /recipe/stew?servings=2.5, so the page and its shopping list disagree.
Plans make this common. The calendar writes whatever number of servings is typed (@./Risotto{2.5%servings}, or 2 1/2 once #677 lands), and half servings are a normal thing to plan.
Cause
Recipe references with a servings target are scaled with cooklang's Recipe::scale_to_target (crates/core/src/shopping_list/mod.rs:995). For servings it rounds the target to a whole number before scaling:
// cooklang 0.19.0, src/scale.rs:128-131Some("servings") | Some("serving") => {// Scale by servings - convert f64 to u32let servings = target_value.round()asu32;self.scale_to_servings(servings, converter)}
The shopping list has used scale_to_target for references since d46b166 ("feat: cook doctor", 2025-08-21). a69b461 ("fix(shopping-list): follow recipe references all the way down") then mirrored the rounding in target_factor (target.round() / base), so recipes referenced further down scale the same wrong way.
Fix
Scale by target / servings in CookCLI when the target is in servings and the recipe has a number of servings. Leave the other cases (yield, no unit, no servings) to scale_to_target, so its errors stay as they are. Draft PR to follow.
The rounding itself is in cooklang-rs; issue filed there too.
Activity
LeMyst commentedon Oct 11, 2026
Filed upstream as cooklang/cooklang-rs#133.
fix(shopping-list): scale a reference to half servings without roundi…