From 966fe80c956fec5dd2fb3ee27b488a8e1453eafa Mon Sep 17 00:00:00 2001 From: jwansek Date: Thu, 2 Mar 2023 16:44:41 +0000 Subject: Updated fetching for the diary page, attempting to ignore automatic curiouscat tweets buy comparing the first 16 characters with the curiouscat table --- database.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database.py b/database.py index 8829615..1a02cea 100755 --- a/database.py +++ b/database.py @@ -227,7 +227,9 @@ class Database: threading.Thread(target = update_cache).start() out = {} with self.__connection.cursor() as cursor: - cursor.execute("SELECT tweet_id, tweeted_at, tweet FROM diary WHERE replying_to IS NULL ORDER BY tweeted_at DESC;") + # cursor.execute("SELECT tweet_id, tweeted_at, tweet FROM diary WHERE replying_to IS NULL ORDER BY tweeted_at DESC;") + # attempt to ignore curiouscat automatic tweets by comparing with the q&a table + cursor.execute("SELECT tweet_id, tweeted_at, tweet FROM diary WHERE replying_to IS NULL AND tweet_id NOT IN (SELECT tweet_id FROM diary INNER JOIN qnas ON SUBSTRING(tweet, 1, 16) = SUBSTRING(question, 1, 16)) ORDER BY tweeted_at DESC;") for tweet_id, tweeted_at, tweet_text in cursor.fetchall(): # print(tweet_id, tweeted_at, tweet_text) out[tweeted_at] = [{ -- cgit v1.2.3