question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Ingredient with `Only check if any amount is in stock` set and unit conversion: Wrong amount on shopping list

See original GitHub issue

EDIT 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
berrndcommented, Dec 15, 2021

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…).

1reaction
berrndcommented, Dec 15, 2021

Note: I tested on the prerelease demo.

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)

 

I expect to see 10 gram of “Tomatogram” because the recipe contains “1 piece” and this - per the QU conversion - corresponds to “10 gram”.

Exactly that happens on the persistent demo instance mentioned before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request (API): Prevent adding an ingredient with a unit for ...
Fix the underlying issue (if my hypothesis is correct: store the required amount in the unit that was given) · Forbid adding an...
Read more >
Shopping/Prices ... - Now You're Cooking! Recipe Software FAQ
Frequently Asked Questions about Now You're Cooking!, a versatile recipe database, meal planner, and grocery shopping manager, for Windows.
Read more >
Changelog & Release History - Grocy
Improved that when editing a unit conversion, the "Quantity unit from" and ... "Only check if any amount is in stock" enabled, to...
Read more >
Bugs in your shopping cart: A Taxonomy - Cem Kaner
incorrect and incomplete calculations when checked in the pre-checkout stage. ❑ Some shopping carts display only the price of the item in the...
Read more >
Documentation - spoonacular recipe and food API
Name Type Example query string pasta cuisine string italian excludeCuisine string greek
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found