Skip to content

Commit

Permalink
Merge pull request #645 from elmadev/dev
Browse files Browse the repository at this point in the history
fix(levels): simplify getLevelIndexesByTags query
  • Loading branch information
sunehs authored Jan 22, 2024
2 parents 099aaca + 2a27424 commit ed08c12
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/api/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,11 @@ const getLevelIndexesByTags = async (tags, onlyOneMatchIsEnough = false) => {
let query = null;
if (tags.length) {
query = `
SELECT DISTINCT level_tags.LevelIndex
FROM level_tags, level
WHERE level_tags.TagIndex IN (:tags)
AND level_tags.LevelIndex = level.LevelIndex
GROUP BY level_tags.LevelIndex
HAVING COUNT(level_tags.TagIndex) >= :compareCount;`;
SELECT lt.LevelIndex
FROM level_tags lt
WHERE lt.TagIndex IN (:tags)
GROUP BY lt.LevelIndex
HAVING COUNT(DISTINCT lt.TagIndex) >= :compareCount;`;
}

if (query) {
Expand Down

0 comments on commit ed08c12

Please sign in to comment.