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

Adding Item Displays Wrong Calories/Cost #483

Open
Bovive opened this issue Apr 17, 2024 · 4 comments
Open

Adding Item Displays Wrong Calories/Cost #483

Bovive opened this issue Apr 17, 2024 · 4 comments

Comments

@Bovive
Copy link

Bovive commented Apr 17, 2024

This one is a bit unusual, and it took me a while to narrow down how it is occurring. One of my products is a stick of butter. It is 1 lb and the calories is 1,920 kcal/pound. If I use Recipe Buddy to import a recipe that uses a stick of butter, the calories are displayed as 1,920 regardless of the quantity that is entered. For example, if I enter 4 tablespoons, it displays at 1,920 kcal on the recipe page. If I edit the amount it still displays incorrectly, even if I change it to teaspoons. If I delete the stick of butter entirely from the recipe and then reenter it in Grocy, the calories and cost are displayed correctly.

I'm not sure where the value for the cost is coming from. It says $12.64 for 4 tablespoons of butter when I import it using Recipe Buddy. When I delete and renter it, the cost changes to $0.40.

Another example is shredded cheddar cheese:
Imported: 880 kcal
Reentered: 440 kcal

It does not seem to affect every item, but I am unable to find a commonality amongst the items that are affected.

@georgegebbett
Copy link
Owner

Hmm - what version of Grocy are you seeing this on? I know there were big changes to how quantity units and conversions between them are handled in Grocy v4, and I've only just started using v4 myself at home so haven't noticed much like this (also we aren't big users of the cost/calorie tracking lol). It might be down to this, I will do some digging.

@Bovive
Copy link
Author

Bovive commented Apr 18, 2024

My Grocy version is 4.2.0. Much appreciated!

@georgegebbett
Copy link
Owner

Okay I have a feeling I know what causes this - I assume you have quantity unit equivalences set up between your stock unit of butter (presumably lbs) and the recipe unit (ozs)?

RB is currently set up so that if your recipe doesn't use the standard quantity unit for an ingredient, it is sent over the wire with the Only check if any amount is in stock flag set to true.

image

This then results in the cost/calorie values being the value for one stock quantity unit multiplied by the ingredient quantity - in this Grocy instance, 1 bottle of Prosecco is 100cal, and it has been multiplied by 500 to get 50,000cal for the 500ml!

image

This is definitely fixable but will require a bit of an overhaul of the way quantity units are put in the UI because if you don't set the only check if any amount flag to true you will get an error for ingredients that don't have a QU mapping set up, so it becomes necessary to ensure that only appropriate QUs are displayed.

This was more obvious in V1 of RB but was sacrificed to the redesign...

@Bovive
Copy link
Author

Bovive commented Apr 19, 2024

Yup, you are absolutely correct. I tested a couple more recipes and that is exactly what is occurring. I appreciate you taking a look into this. On the bright side, only showing appropriate QUs in the UI is kind of a nice feature to have anyway.

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

No branches or pull requests

2 participants