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

Bug: Cannot consume recipe if ingredients with disabled stock fulfillment checking (inventory check) in there (aka how to handle optional ingredients?) #2533

Closed
rugk opened this issue May 4, 2024 · 1 comment

Comments

@rugk
Copy link

rugk commented May 4, 2024

STR

  1. Add an ingredient for a recipe and disable "stock fulfillment checking" for it. Like this:
    grafik
  2. From now on, it will always be shown as "Enough in stock":
    grafik
  3. Now, have not enough in stock of that ingredient…
  4. Try to consume the recipe, which does work:
    grafik
grocytreprdoucer.mp4

Reproduce on https://test-hx3ngku7e60u2dztka2kw.demo-prerelease.grocy.info/recipes?recipe=7# with the "Test" recipe.

What happens

Error message and internal server error:

"{\"error_message\":\"Amount to be consumed cannot be > current stock amount (if supplied, at the desired location)\"}"

That is technically correct, but surprising, as the Frontend (obviously) shows "Enough in stock".
Furthermore, if you have, say 10 ingredients, it does not say which ingredient causes the error and you cannot see it in the overview – again, it's shown as "Enough in stock".

What should happen

  • first of all, maybe directly showing such a user-friendly error may be an option instead of hiding it behind this generic error:
    grafik
  • That said, if the error is in the Frontend there are two options:
    • that recipe should not be consumable -> then, the button to consume should not be clickable/disabled, as it is when inventory checking is enabled (though as you cannot see why it is not consumable, IMHO this would not be a good solution)
    • or, as I guess it's rather the case, the recipe should be consumable, but it should ignore the ingredient, which are marked as without "stock fulfillment checking"?

Actual use case

I guess the expected behaviour depends strongly on the use case here.

So what was my actual use case in production? Well… easy… I want "optional ingredients" aka ingredients, which can be added to a recipe, but are not required for it. E.g.

  • toppings on top of it
  • side dishes like apple purée to rice budding or so…
  • etc.

IMHO these warrant no new recipe and there can be a lot. E.g. for said rice budding you could optionally have/add (and have as an optional ingredient) apple purée, chocolate, cinnamon (and/or) sugar as a topping etc. etc. These are all just slight variations on the recipe, and all combinations of the three variants would already warrant like dunno… 6 different variants? 6 recipes would certainly be an overkill for this…

Anyway, thus I select "Disable stock fulfillment checking for this ingredient", because I do not have to have this in stock for the recipe. I can make the recipe as it is, but just may add the ingredient if needed.

Alternative idea

A very cool solution for the issue at hand would be that, in case of such an "optional ingredient" in the recipe:

  • if it is tried to be consumed, show a list of all optional ones (and how much you actually have in stock), and you can (de)select each ingredient
  • Recipe can obviously only be consumed if ingredients that are in stock have been checked.
  • All ingredients selected are then consumed…

This would circumvent the error, as no ingredients are tried to be consumed, which are not in stock.

I would also remove the "Enough in stock" label for items, which have this checking disabled and actually are not in stock and just don't show the "Enough in stock" label (this is how Grocy for Android AFAIK does it) or show something like "stock is not checked for this ingredient".

More information

FYI, this is how it is shown compared to when inventory checking is enabled:
grafik

Also, on Grocy for Android such an internal error message is quite fatal, as it does not show the error at all, but just says an error happened… Created patzly/grocy-android#866 for that.

@berrnd
Copy link
Member

berrnd commented May 4, 2024

I guess the expected behaviour depends strongly on the use case here.

True words. But what's the point then about reporting something personal use case specific as a bug and not as an enhancement idea?

 

I want "optional ingredients"

This is not something Grocy currently has as of today. "Disable stock fulfillment checking for this ingredient" does what it says and nothing more, especially not magically giving a non existent "optional ingredients feature" for specifically your expected personal use case.

 
You mix multiple topics and even unrelated community contributed project requests here - that's untrackable and therefore explicitly mentioned in the issue template to avoid.

Most of you what you personally expect is already tracked in those other (proper) Feature Requests - feel free to add your ideas there if you really think it's not already covered by what's written there (and please check existing requests beforehand next time and don't report each and everything you personally want to behave differently as a bug):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants