From f6c750a1ea95c47ad3c28603d48bf3c3f3081d22 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 23 Jan 2022 12:43:16 +0100 Subject: [PATCH] Fixed meal plan calories display (fixes #1757) --- changelog/66_UNRELEASED_xxxx-xx-xx.md | 1 + public/viewjs/mealplan.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog/66_UNRELEASED_xxxx-xx-xx.md b/changelog/66_UNRELEASED_xxxx-xx-xx.md index 117d285a..c4c30d31 100644 --- a/changelog/66_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/66_UNRELEASED_xxxx-xx-xx.md @@ -4,6 +4,7 @@ - When using reverse proxy authentication (`ReverseProxyAuthMiddleware`), it's now also possible to pass the username in an environment variable instead of an HTTP header (new `config.php` option `REVERSE_PROXY_AUTH_USE_ENV`) (thanks @Forceu) - Performance improvements (page loading time) of the recipes page - Fixed that stock entry labels on purchase were printed, even when "No label" was selected (was only a problem when running label printer WebHooks server side) +- Fixed that the meal plan showed the total calories per recipe (instead of per serving as stated by the suffix) - Fixed that formatted (HTML) text for the (hidden by default) product description column on the stock overview page was not correctly displayed - Fixed that numeric and date-time sorting of table columns on the stock entries page did not work correctly (thanks @MasterofJOKers) - Fixed that the barcode lookup for the "Stock by-barcode" API endpoints was case sensitive diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index f53df808..da47b1fb 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -160,11 +160,11 @@ $(".calendar").each(function() var costsAndCaloriesPerServing = "" if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) { - costsAndCaloriesPerServing = '
' + resolvedRecipe.costs + ' / ' + resolvedRecipe.calories + ' kcal ' + __t('per serving') + '
'; + costsAndCaloriesPerServing = '
' + resolvedRecipe.costs + ' / ' + resolvedRecipe.calories / mealPlanEntry.recipe_servings + ' kcal ' + __t('per serving') + '
'; } else { - costsAndCaloriesPerServing = '
' + resolvedRecipe.calories + ' kcal ' + __t('per serving') + '
'; + costsAndCaloriesPerServing = '
' + resolvedRecipe.calories / mealPlanEntry.recipe_servings + ' kcal ' + __t('per serving') + '
'; } if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK) @@ -237,11 +237,11 @@ $(".calendar").each(function() var costsAndCaloriesPerServing = "" if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) { - costsAndCaloriesPerServing = '
' + productDetails.last_price * mealPlanEntry.product_amount + ' / ' + productDetails.product.calories * mealPlanEntry.product_amount + ' kcal ' + '
'; + costsAndCaloriesPerServing = '
' + productDetails.last_price * mealPlanEntry.product_amount + ' / ' + productDetails.product.calories + ' kcal ' + '
'; } else { - costsAndCaloriesPerServing = '
' + productDetails.product.calories * mealPlanEntry.product_amount + ' kcal ' + '
'; + costsAndCaloriesPerServing = '
' + productDetails.product.calories + ' kcal ' + '
'; } var shoppingListButtonHtml = "";