fix rating and fav
This commit is contained in:
@@ -115,10 +115,13 @@ export default (router, tpl) => {
|
||||
try {
|
||||
const slug = '%' + lib.slugify(q) + '%';
|
||||
const rows = await db`
|
||||
SELECT t.tag, t.normalized, COUNT(ta.item_id) as uses
|
||||
SELECT t.tag, t.normalized, COUNT(DISTINCT items.id) as uses
|
||||
FROM tags t
|
||||
JOIN tags_assign ta ON ta.tag_id = t.id
|
||||
JOIN items ON items.id = ta.item_id
|
||||
WHERE t.id > 2
|
||||
AND items.active = true
|
||||
AND items.is_deleted = false
|
||||
AND lower(t.normalized) ILIKE ${slug}
|
||||
GROUP BY t.tag, t.normalized
|
||||
ORDER BY uses DESC
|
||||
|
||||
Reference in New Issue
Block a user