From 9239441d7321a75c581b708226cb77d201e1bf0b Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 26 Jul 2023 23:56:40 +0000 Subject: [PATCH] Fixed duplicate tags. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4364 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/ssb/tf-app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index d537e838..ee30ffa9 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -268,8 +268,9 @@ class TfElement extends LitElement { recent_mentions AS (SELECT recent.id, json_extract(mention.value, '$.link') AS tag FROM recent, json_each(recent.content, '$.mentions') AS mention WHERE json_valid(mention.value) AND tag LIKE '#%'), - combined AS (SELECT id, tag FROM recent_channels UNION ALL SELECT id, tag FROM recent_mentions) - SELECT tag, COUNT(*) AS count FROM combined GROUP BY id, tag ORDER BY count DESC LIMIT 10 + combined AS (SELECT id, tag FROM recent_channels UNION ALL SELECT id, tag FROM recent_mentions), + by_message AS (SELECT DISTINCT id, tag FROM combined) + SELECT tag, COUNT(*) AS count FROM by_message GROUP BY tag ORDER BY count DESC LIMIT 10 `, [new Date() - 7 * 24 * 60 * 60 * 1000]); console.log('tags took', (new Date() - start) / 1000.0, 'seconds'); }