PATCH: Retrieving last 50 chats now
This commit is contained in:
@@ -76,6 +76,8 @@ def get_past_chat(stream_id: int):
|
|||||||
|
|
||||||
# fetched in format: [(username, message, time_sent, is_subscribed)]
|
# fetched in format: [(username, message, time_sent, is_subscribed)]
|
||||||
all_chats = db.fetchall("""
|
all_chats = db.fetchall("""
|
||||||
|
SELECT username, message, time_sent, is_subscribed
|
||||||
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
u.username,
|
u.username,
|
||||||
c.message,
|
c.message,
|
||||||
@@ -89,7 +91,9 @@ def get_past_chat(stream_id: int):
|
|||||||
LEFT JOIN subscribes s ON c.chatter_id = s.user_id AND s.subscribed_id = ?
|
LEFT JOIN subscribes s ON c.chatter_id = s.user_id AND s.subscribed_id = ?
|
||||||
WHERE c.stream_id = ?
|
WHERE c.stream_id = ?
|
||||||
ORDER BY c.time_sent DESC
|
ORDER BY c.time_sent DESC
|
||||||
LIMIT 50;
|
LIMIT 50
|
||||||
|
) subquery
|
||||||
|
ORDER BY time_sent ASC;
|
||||||
""", (stream_id, stream_id))
|
""", (stream_id, stream_id))
|
||||||
|
|
||||||
db.close_connection()
|
db.close_connection()
|
||||||
|
|||||||
Reference in New Issue
Block a user