Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Optimize Only check if any amount is in stock recipe ingredients shopping list amount when no unit conversion is supplied #2545

Open
AllesMeins opened this issue Jun 13, 2024 · 8 comments

Comments

@AllesMeins
Copy link

When using the "Add to shopping list" button, grocy messes up the units for all ingredients that have "Only check if any amount is in stock" selected.

Current behavior:
For my recipe I need 300g of tomato. In the master data I've already created an entry for tomatoes with "piece" as the default unit. Since tomatoes can have different weights I can't define a conversion from "piece" to "gram". So when creating the recipe I select "Only check if any amount is in stock", change the unit to "grams" and add 300 as the amount. This works fine - in the recipe it is displayed as "Ingredients: 300g tomato". But when adding it to the shopping list it becomes "300 pieces of tomato". So for some reason it doesn't carry over the unit and instead tries to convert it to the default unit with a ratio of 1:1.

Expected/Desired behavior:
Grocy should not try to convert units where there is no conversion rule supplied. It doesn't really help with checking the stock since I'd argue that very seldom somebody has 300 tomatoes in stock. And it looks like a bug to the user if they find 1200 chickens and 300 tomatoes on their shopping list. Instead it should just add the amount and unit as it is given without any conversion when the "Only check if any amount is in stock"-box is selected.

As for stock fulfillment it should behave like it is already described in the help-text next to the "Only check if any amount is in stock"-checkbox: "A different amount/unit can then be used below while for stock fulfillment checking it is sufficient when any amount of the product is in stock".

@AllesMeins AllesMeins changed the title Feature Request/Bug: Grocy falsly converts units when "Only check if any amount is in stock" in a recipe is selected Feature Request/Bug: "Add to shopping list" falsly converts units when "Only check if any amount is in stock" is selected Jun 13, 2024
@berrnd
Copy link
Member

berrnd commented Jun 13, 2024

Quoting myself from the origin of this request:

Maybe that's how it works for you, but that's not necessarily the case for everyone.

Fun fact: That was exactly the case until v3.2.0. See #1718 and v3.2.0 changelog where this has been changed due to someone wanted to have this behaving differently. I already noted there that it doesn't make that much sense practically, but I've changed it anyways due to consistency reasons.

So obviously and kind of always, the bigger challenge is to make it fit everyone - feel free to propose an in-depth idea for that on the corresponding new Feature Request.

So I'm looking forward for such an in-depth proposal on how to make this fit everyone, everyone is invited to provide that. Changing it back and forth based on complains from the either and the other side is definitely not an option.

 

It doesn't really help with checking the stock since I'd argue that very seldom somebody has 300 tomatoes in stock. And it looks like a bug to the user if they find 1200 chickens and 300 tomatoes on their shopping list.

Lol, what an absurd comparison. You even mentioned yourself just minutes ago that you "don't like software that tries to guess what I want", but here it should magically guess that 1200 chickens or 300 tomatoes is not what you want? Hilarious.

@berrnd berrnd changed the title Feature Request/Bug: "Add to shopping list" falsly converts units when "Only check if any amount is in stock" is selected Feature Request: Optimize Only check if any amount is in stock recipe ingredients shopping list amount when no unit conversion is supplied Jun 13, 2024
@berrnd
Copy link
Member

berrnd commented Jun 13, 2024

Additionally quoting someone else from the mentioned origin of this request:

I suspect you'd find it more useful to put in a conversion with the average weight of a tomato
[...]
That'd let Grocy give you an idea if you actually have enough tomatoes in stock for the recipe and also let it give you an approximate count to buy.

Have you tried that? Sounds for me like a practically oriented very good solution for this "problem".

@AllesMeins
Copy link
Author

AllesMeins commented Jun 13, 2024

Fun fact: That was exactly the case until v3.2.0. See #1718 and v3.2.0 changelog where this has been changed due to someone wanted to have this behaving differently. I already noted there that it doesn't make that much sense practically, but I've changed it anyways due to consistency reasons.

I don't think #1718 applies here. If I understand it correctly, they were talking about a scenario where there is a conversion-rule available. And I'm completely fine with their wish. If there is a conversion defined for this ingredient or unit: Go for it and convert it.

I'm talking about the situation where their is no QU conversion defined. Currently grocy seems to go "I've no idea how much 300g tomatoes is, so I'm just assuming that one gram equals one piece of tomatoe" - resulting in a shopping list where I've entries like "300 pieces of tomatoe" and I don't see the benefit of this. Why try to convert a unit when there is no conversion-rule available?

So my proposal would be:

  • If "Only check if any amount is in stock" is selected, check whether there is any QU-conversion available for the given unit. If this is the case, everything is fine. Don't change the current behavior.
  • If this is not the case don't do a 1:1 conversion, but just add the amount and unit as specified in the recipe to the shopping list (and do the check whether stock quantity >1, as explained in the help text).

I don't have a complete overview over all the wishes out there. But this shouldn't break #1718. Of cause I only see the use-cases that I'm aware of, so if you're aware of any benefit of doing this 1:1 conversions, let me know. Maybe I can think of a way to factor those in as well.

It doesn't really help with checking the stock since I'd argue that very seldom somebody has 300 tomatoes in stock. And it looks like a bug to the user if they find 1200 chickens and 300 tomatoes on their shopping list.

Lol, what an absurd comparison.

But it isn't a comparison. It's an actual example what is currently happening for me. I created a recipe and provide that it needs 300g of tomatoes and 1200g of chicken and I end up with 300 pieces of tomato and 1200 pieces of chicken on my shopping list. How can this not look like a bug to an average user?

but here it should magically guess that 1200 chickens or 300 tomatoes is not what you want? Hilarious.

No, it should explicitly not guess what I want. It should just take the provided ingredients from the recipe and put it on the shopping list when there is no conversion-rule available.

Have you tried that? Sounds for me like a practically oriented very good solution for this "problem".

Sounds more like a workaround to me. Of cause I could go and guess the average weight of every produce that is sold by piece and by weight, but I still don't see why not just to add the one quantity that is known to be right (the one defined in the recipe) when there is no conversion rule available?

@berrnd
Copy link
Member

berrnd commented Jun 13, 2024

I don't have a complete overview over all

Just to mention two related other functions of Grocy which need then special handling for this, adding more complexity everywhere (most likely that's not everything which need to be touched when essentially allowing arbitrary units on shopping list items):

  • Recipe ingredient amount comparison with what's on the shopping list for missing ingredients. Such a comparison can't work without a conversion factor when different units are involved.
  • "Shopping list to stock workflow": Grocy necessarily needs the factor to get the QU stock from whatever is on the shopping list when adding anything to stock. It's therefore currently impossible to use a unit on the shopping list where no direct or indirect conversion exists for the related product / unit.

 

How can this not look like a bug to an average user?

You can input bullshit, Grocy does math based on its definition, probably this leads to output bullshit without that much surprise. If user-errors are now also treated as Bugs, I'll be most likely even more out here than I'm already be.

 

but I still don't see why not just to add the one quantity that is known to be right (the one defined in the recipe) when there is no conversion rule available?

I just mentioned two other implications involved, Grocy is not a simple and dumb shopping list tool, having proper conversion factors available is pretty naturally essential for having and being able to provide a proper stock management experience.

 
If this example here is how you use Grocy for each and every recipe (ingredient), maybe Grocy is just the wrong tool and you're probably happier with a simple recipe manager instead.

@AllesMeins

This comment has been minimized.

@berrnd

This comment has been minimized.

@AllesMeins

This comment was marked as off-topic.

@berrnd

This comment was marked as off-topic.

@grocy grocy locked and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants