diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa55b554..717efb61b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +### Fixed +- Fixed keywords of shared recipes counted multiple times, fixes #491 + [#493](https://github.com/nextcloud/cookbook/pull/493/) @seyfeb + ## 0.7.8 - 2021-01-08 diff --git a/lib/Db/RecipeDb.php b/lib/Db/RecipeDb.php index 02a0b4c51..6729928c4 100755 --- a/lib/Db/RecipeDb.php +++ b/lib/Db/RecipeDb.php @@ -80,7 +80,12 @@ public function findAllRecipes(string $user_id) { ->where('r.user_id = :user') ->orderBy('r.name'); $qb->setParameter('user', $user_id, TYPE::STRING); - $qb->leftJoin('r', self::DB_TABLE_KEYWORDS, 'k', 'r.recipe_id = k.recipe_id'); + $qb->leftJoin('r', self::DB_TABLE_KEYWORDS, 'k', + $qb->expr()->andX( + 'r.recipe_id = k.recipe_id', + 'k.user_id = :user' + ) + ); $cursor = $qb->execute(); $result = $cursor->fetchAll();