From a2542c658b651850f71ed304c7c901c4e79a938b Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 16 Jul 2023 23:41:41 +0000 Subject: [PATCH] Better tag enumerating. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4349 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/ssb/tf-app.js | 10 +++++----- apps/todo/script.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index f7ace23ca..d537e8384 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -259,17 +259,17 @@ class TfElement extends LitElement { let start = new Date(); this.tags = await tfrpc.rpc.query(` WITH - recent AS (SELECT content FROM messages + recent AS (SELECT id, content FROM messages WHERE messages.timestamp > ? AND json_extract(content, '$.type') = 'post' ORDER BY timestamp DESC LIMIT 1024), - recent_channels AS (SELECT '#' || json_extract(content, '$.channel') AS tag + recent_channels AS (SELECT recent.id, '#' || json_extract(content, '$.channel') AS tag FROM recent WHERE json_extract(content, '$.channel') IS NOT NULL), - recent_mentions AS (SELECT json_extract(mention.value, '$.link') AS tag + 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 tag FROM recent_channels UNION ALL SELECT tag FROM recent_mentions) - SELECT tag, COUNT(*) AS count FROM combined GROUP BY tag ORDER BY count DESC LIMIT 10 + 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 `, [new Date() - 7 * 24 * 60 * 60 * 1000]); console.log('tags took', (new Date() - start) / 1000.0, 'seconds'); } diff --git a/apps/todo/script.js b/apps/todo/script.js index 00720b51c..07c1c07b9 100644 --- a/apps/todo/script.js +++ b/apps/todo/script.js @@ -119,7 +119,7 @@ class TodoListElement extends LitElement { } else { return html`
self.handle_check(x, item)}> - self.editing = index}>${item.text} + self.editing = index}>${item.text || '(empty)'} `; } }