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

Nutritional Info is not divided by the number of servings #66

Closed
keyname opened this issue Feb 22, 2023 · 19 comments
Closed

Nutritional Info is not divided by the number of servings #66

keyname opened this issue Feb 22, 2023 · 19 comments
Labels

Comments

@keyname
Copy link

keyname commented Feb 22, 2023

When the Nutritional Info is rendered, the total number of calories and macronutrients are shown, the amounts are not divided by the number of servings.

  • Plugin version: dev-develop-v4 as 4.0.6
  • Craft version: 4.3.10
@keyname keyname added the bug label Feb 22, 2023
@khalwat
Copy link
Contributor

khalwat commented Feb 22, 2023

Can you add a screenshot that shows what you're seeing, and what you're expecting to see?

@keyname
Copy link
Author

keyname commented Feb 22, 2023

Screenshot 2023-02-22 at 1 57 12 PM

Screenshot 2023-02-22 at 1 57 32 PM

No matter how many servings, the recipe is divided into, the nutritional information does not change.
Nutritional labels should show the calories, etc. for each serving, not the whole recipe.

@khalwat
Copy link
Contributor

khalwat commented Feb 22, 2023

Thanks for that! Should be easy to fix.

khalwat added a commit that referenced this issue Feb 22, 2023
…take into account the number of serviings ([#66](#66))
khalwat added a commit that referenced this issue Feb 22, 2023
…take into account the number of serviings ([#66](#66))
@khalwat
Copy link
Contributor

khalwat commented Feb 22, 2023

Addressed in: fde3876 & bb72482

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop as 1.4.4",

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop-v4 as 4.0.7",

Then do a composer clear-cache && composer update

@khalwat khalwat closed this as completed Feb 22, 2023
@keyname
Copy link
Author

keyname commented Feb 22, 2023

Raw numbers have been corrected, but percentages still need to be corrected.

@khalwat
Copy link
Contributor

khalwat commented Feb 22, 2023

Addressed in: a5da044 & 818cb11

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop as 1.4.4",

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop-v4 as 4.0.7",

Then do a composer clear-cache && composer update

@keyname
Copy link
Author

keyname commented Feb 22, 2023

"Serving Size" does not update according to the number of servings.

@khalwat
Copy link
Contributor

khalwat commented Feb 22, 2023

hmmm... should "serving size" change with "servings" though?

@keyname
Copy link
Author

keyname commented Feb 22, 2023

Yes. If I make a recipe that has a total weight of 500g, and serves five people.
The Serving Size is 100g, not 500g.

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2023

Addressed in: d1d5b82 & 088b9db

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop as 1.4.4",

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop-v4 as 4.0.7",

Then do a composer clear-cache && composer update

@keyname
Copy link
Author

keyname commented Feb 23, 2023

I'm getting the following error: Error rendering recipe-nutrition-facts -> An exception has been thrown during the rendering of a template ("A non-numeric value encountered").

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2023

Probably you have something non-numeric in the servingSize field. If you want to do division based on the serving size, it needs to be a number.

@keyname
Copy link
Author

keyname commented Feb 23, 2023

Screen shot attached showing the value currently in the Nutrition tab Serving Size.

Screenshot 2023-02-22 at 8 28 35 PM

@keyname
Copy link
Author

keyname commented Feb 23, 2023

Additional Screenshot showing the ingredients and Recipe Serves field.
Screenshot 2023-02-22 at 8 36 05 PM

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2023

Yes, 258 grams is a text string, not a number.

@keyname
Copy link
Author

keyname commented Feb 23, 2023

That's what is entered by the plug-in when I fetch the nutrition info... not entered manually.

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2023

Addressed in: 2f6a74b & 678739a

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop as 1.4.4",

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-recipe": "dev-develop-v4 as 4.0.7",

Then do a composer clear-cache && composer update

@keyname
Copy link
Author

keyname commented Feb 23, 2023

Working great now. Thanks! : )

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2023

Okay, will cut a release shortly

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

No branches or pull requests

2 participants