Bug: Ingredient with `Only check if any amount is in stock` set and unit conversion: Wrong amount on shopping list
See original GitHub issueEDIT by @berrnd:
When the ingredient option Only check if any amount is in stock
is checked, the amount on the shopping list is wrong when unit conversions are involved (since the ingredient amount is treated as 1
internally for everything).
Overall goal
Track a product in gram but add it as piece to recipes. E.g. buy a kilo of tomatoes, but have a recipe say “5 tomatoes”. Then when adding the ingredients to the shopping list the correct amount should be added (either gram or pieces).
Setup for this case
- add “Tomatogram” as new product
- set its units to gram (note: not piece)
- add QU conversions so that one piece is 10 gram and 1 gram is 0.1 piece
- create recipe for 1 serving
- add sole ingredient “Tomatogram”, change its unit to piece and set amount to 1 (so 1 tomato is needed)
- add this recipe to shopping list
What do I observe in the shopping list?
1 gram of “Tomatogram” is being added to the shopping list. This is wrong.
Note: I tested on the prerelease demo.
What do I expect in the shopping list?
I expect to see 10 gram of “Tomatogram” because the recipe contains “1 piece” and this - per the QU conversion - corresponds to “10 gram”.
Note: This might not be a bug but a feature request (that is, respecting the QU conversion). But it feels like an error that 1 piece of Tomatogram is added as 1 gram to the shopping list. The issue title might have to be changed depending on how you interpret this issue.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Only check if any amount is in stock
was originally supposed for things like spices where it’s not suitable to buy the amount per recipe when needed. Internally for stock fulfillment checking and the rest, just> 0
is used instead of the entered amount in that case (as the help text for that option kind of implies).So ok, let’s track it as a bug that regardless of that option, the amount on the shopping list should be correct (however if that makes practically sense or not, for me not so much…).
Would be great if you can do that on a persistent demo instance, much easier to look into it by that and also mentioned on the issue template - most of the time there is much more around than you described above.
Did that: https://test-9mm998wdqumujfmfzxn76h.demo-prerelease.grocy.info (Recipe, Product, Shopping List)
Exactly that happens on the persistent demo instance mentioned before.