Improved page loading time of /recipes and /mealplan when having a big meal plan (closes #695)

This commit is contained in:
Bernd Bestel
2021-07-10 22:56:39 +02:00
parent 6660e1ff73
commit 7ee15946c7
5 changed files with 97 additions and 24 deletions

View File

@@ -87,9 +87,29 @@ class RecipesService extends BaseService
return $this->getDataBaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
}
public function GetRecipesResolved(): Result
public function GetRecipesResolved($customWhere = null): Result
{
return $this->getDatabase()->recipes_resolved();
if ($customWhere == null)
{
return $this->getDatabase()->recipes_resolved();
}
else
{
return $this->getDatabase()->recipes_resolved()->where($customWhere);
}
}
// The same as GetRecipesResolved but without the column "missing_products_count" to improve performance when this is not needed
public function GetRecipesResolved2($customWhere = null): Result
{
if ($customWhere == null)
{
return $this->getDatabase()->recipes_resolved2();
}
else
{
return $this->getDatabase()->recipes_resolved2()->where($customWhere);
}
}
public function __construct()