diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 116771ad..e1e21364 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -11,6 +11,7 @@ ### Recipe improvements/fixes - Recipe printing improvements (thanks @Ape) +- Calories are now always displayed per single serving (on the recipe and meal plan page) - Fixed that "Only check if any amount is in stock" (recipe ingredient option) didn't work for stock amounts < 1 ### Chores fixes diff --git a/migrations/0129.sql b/migrations/0129.sql index b0ecab57..6e0a0864 100644 --- a/migrations/0129.sql +++ b/migrations/0129.sql @@ -25,7 +25,7 @@ SELECT rp.note, rp.variable_amount AS recipe_variable_amount, rp.only_check_single_unit_in_stock, - rp.amount * (r.desired_servings*1.0 / r.base_servings*1.0) * (rnr.includes_servings*1.0 / CASE WHEN rnr.recipe_id != rnr.includes_recipe_id THEN rnrr.base_servings*1.0 ELSE 1 END) * IFNULL(p.calories, 0) AS calories, + rp.amount / r.base_servings*1.0 * (rnr.includes_servings*1.0 / CASE WHEN rnr.recipe_id != rnr.includes_recipe_id THEN rnrr.base_servings*1.0 ELSE 1 END) * IFNULL(p.calories, 0) AS calories, p.active AS product_active FROM recipes r JOIN recipes_nestings_resolved rnr @@ -74,7 +74,7 @@ SELECT rp.note, rp.variable_amount AS recipe_variable_amount, rp.only_check_single_unit_in_stock, - rp.amount * (r.desired_servings*1.0 / r.base_servings*1.0) * (rnr.includes_servings*1.0 / CASE WHEN rnr.recipe_id != rnr.includes_recipe_id THEN rnrr.base_servings*1.0 ELSE 1 END) * IFNULL(p.calories, 0) AS calories, + rp.amount / r.base_servings*1.0 * (rnr.includes_servings*1.0 / CASE WHEN rnr.recipe_id != rnr.includes_recipe_id THEN rnrr.base_servings*1.0 ELSE 1 END) * IFNULL(p.calories, 0) AS calories, p.active AS product_active FROM recipes r JOIN recipes_nestings_resolved rnr diff --git a/views/recipes.blade.php b/views/recipes.blade.php index 06c04187..3b46c0f0 100644 --- a/views/recipes.blade.php +++ b/views/recipes.blade.php @@ -311,16 +311,20 @@