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: The price of recipes (in the meal plan) is incorrect when ingredients are not in stock #1771

Closed
JJJWD opened this issue Feb 2, 2022 · 4 comments

Comments

@JJJWD
Copy link

JJJWD commented Feb 2, 2022

If you look at the meal plan in the demo https://demo-prerelease.grocy.info/mealplan?start=2022-01-30 you can check the price for the pizza and spaghetti Bolognese and see the cost of these meals only contain the items in stock. This issue seem to be a bug of the recipes themselves which becomes noticeable in the meal plan. (The pancakes item on Thursday however seems to be an exception to this case and I cannot figure out when looking at the recipe why the dish is so expensive. This would be a different bug. )

I did notice that any product added to the meal plan uses the latest(?) known price in the meal plan costs even when not in stock. I would like this to be the same case for the recipes.

@JJJWD JJJWD added the bug label Feb 2, 2022
@berrnd
Copy link
Member

berrnd commented Feb 2, 2022

I did notice that any product added to the meal plan uses the latest(?) known price in the meal plan costs even when not in stock.

I can't say where you noticed that, an example would be great.

Recipe costs are (since kind of ever) based on only-in stock items. Meal plan entries are simply recipes, so everything can only be the same.

If you want to have prices for not-in stock products, that would be a feature request, definitely not a bug. And would most probably need to have configuration options, the last price is only one option. Maybe someone prefers the average over the last x days, or the last price from the products default store, or the last store, or the one which the product was bought most, or...

That the price is based on in-stock ingredients is also noted next to any ingredient:
 
grafik

No difference in the price for the same serving amount between recipes and the meal plan:
 
grafik
grafik
grafik
grafik

The pancakes item on Thursday however seems to be an exception to this case and I cannot figure out when looking at the recipe why the dish is so expensive.

Demo data is generated partly randomized. So what looks expensive doesn't say anything, they are just random numbers.

@JJJWD
Copy link
Author

JJJWD commented Feb 3, 2022

Sorry, I had missed the part of the price only being based on the items in stock since I was too focused on the calories and price part at the end of each ingredient line.

I have created a demo to show the issue with the products displaying a price in the meal plan https://test-749d2cyz3acukwjg0246eo.demo.grocy.info/mealplan?start=2022-01-30. The pizza and the headers of the days do show the correct price of $0.00 however the cucumber and cheese show their last recorded price.

Edit: I'm not sure how the week costs at the top of the meal plan is calculated
Edit 2: Sunday 2/6 contains a pancakes serving of the same price
image

@berrnd
Copy link
Member

berrnd commented Feb 3, 2022

The pizza and the headers of the days do show the correct price of $0.00 however the cucumber and cheese show their last recorded price.

Pizza is a recipe, Cucumber and Cheese are products. Recipe prices are based on in-stock ingredients only. Products show always the last price on the meal plan, regardless if in-stock or not - also since it's possible to add single products to the meal plan. Each in-stock item of the same product could theoretically have a different price, so showing one of them on the meal plan without knowing which one exactly you plan to use would be random. And I doubt that it's practically really necessary to be able to plan the 5 cent more expensive Cucumber to be used on Tuesday, while eating the cheaper one on Wednesday. Yes, your week costs are inaccurate by that, but grocy is here to manage your fridge, not your business.

Edit: I'm not sure how the week costs at the top of the meal plan is calculated

By summarizing all recipes and products of the corresponding week, no rocket science involved.

Edit 2: Sunday 2/6 contains a pancakes serving of the same price

Localization / regional settings problem: The demo meal plan starts on Sunday, but the server behind and everything related is based on German regional settings (where the week starts on Monday). That doesn't fit and lead to recipes/products from Mondays and/or Sundays to not be properly included in week costs. Known theoretical problem, no practical problem, since on your personal installation, you define the settings to fit your locale. References #516 and #214. The demo is just a demo.

@berrnd
Copy link
Member

berrnd commented Feb 8, 2022

Just a cross-reference here to #779 about that recipe costs ore currently based on in-stock ingredients only:

Out of stock items are not included in recipes costs since v3.0.0.

Before the change that recipe costs are based on the default consume rule, all prices were based on the corresponding products last price.

Let's change again that for out of stock ingredients, the last price is used again. I think that reflects current recipe costs best - will be done for the next release.

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