Commit 3747d4d1 by Luis Perez

corregido error en lista de la compra cuando no se han guardado ninguna receta

parent 246daf5a
......@@ -48,7 +48,7 @@ class Controller_Listacompra_Index extends \Controller_App{
$recipe_ids[] = $recipe->id;
}
$view->ingredients = Model_Ingredient::get_ingredients_week($recipe_ids);
$view->ingredients = count($recipe_ids)>0 ? Model_Ingredient::get_ingredients_week($recipe_ids) : array();
//Titulo de la vista
$view->title = "Lista de la Compra";
......
......@@ -59,9 +59,11 @@ class Model_Recipe extends Model{
$recipe = $this->ws_recipe_get($this->recipe_id);
if(!$recipe)
return array();
foreach ($recipe->ingredients as $ingredientRecipe)
{
$ingredient = Model_Ingredient::forge();
$ingredient->ingredient_id = $ingredientRecipe->id;
......@@ -73,7 +75,6 @@ class Model_Recipe extends Model{
$ingredient->created_at = date("Y-m-d H:i:s");
$this->ingredients[] = $ingredient;
}
$this->loaded = 'S';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment