Fix plots not generated until after item is posted

This commit is contained in:
ekzyis 2024-03-18 06:43:45 +00:00
parent b8188fbb2e
commit fc0d9d0690
1 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,11 @@
.headers on .headers on
.mode csv .mode csv
.output hacker_news.csv .output hacker_news.csv
SELECT id, created_at, time, title, url, author, ndescendants, score, rank SELECT hn.id, hn.created_at, hn.time, hn.title, hn.url, hn.author, hn.ndescendants, hn.score, hn.rank
FROM hn_items FROM (
WHERE id IN (SELECT hn_id FROM sn_items) SELECT id, MAX(created_at) AS created_at FROM hn_items
ORDER BY id, created_at DESC; WHERE rank = 1 AND length(title) >= 5
GROUP BY id
ORDER BY time ASC
) t JOIN hn_items hn ON t.id = hn.id
ORDER BY hn.id, hn.created_at DESC;