mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Fixed recipes page when there are no recipes
This commit is contained in:
parent
0134535a5e
commit
4c399392eb
@ -72,7 +72,15 @@ class RecipesController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
$selectedRecipePositionsResolved = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
|
||||
$selectedRecipePositionsResolved = null;
|
||||
$totalCosts = null;
|
||||
$totalCalories = null;
|
||||
if ($selectedRecipe)
|
||||
{
|
||||
$selectedRecipePositionsResolved = $this->getDatabase()->recipes_pos_resolved()->where('recipe_id = :1 AND is_nested_recipe_pos = 0', $selectedRecipe->id)->orderBy('ingredient_group', 'ASC', 'product_group', 'ASC');
|
||||
$totalCosts = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->costs;
|
||||
$totalCalories = FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories;
|
||||
}
|
||||
|
||||
$renderArray = [
|
||||
'recipes' => $recipes,
|
||||
@ -85,8 +93,8 @@ class RecipesController extends BaseController
|
||||
'userfields' => $this->getUserfieldsService()->GetFields('recipes'),
|
||||
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('recipes'),
|
||||
'quantityUnitConversionsResolved' => $this->getDatabase()->quantity_unit_conversions_resolved(),
|
||||
'selectedRecipeTotalCosts' => FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->costs,
|
||||
'selectedRecipeTotalCalories' => FindObjectInArrayByPropertyValue($recipesResolved, 'recipe_id', $selectedRecipe->id)->calories
|
||||
'selectedRecipeTotalCosts' => $totalCosts,
|
||||
'selectedRecipeTotalCalories' => $totalCalories
|
||||
];
|
||||
|
||||
if ($selectedRecipe)
|
||||
|
Loading…
x
Reference in New Issue
Block a user