Change logic to store all subreddits as lowercase.

This commit is contained in:
2025-07-22 14:48:54 +02:00
parent 966ef45916
commit afe3cecb4f
2 changed files with 10 additions and 7 deletions

View File

@@ -310,7 +310,7 @@ def get_deep_dive_details(ticker_symbol):
JOIN mentions m ON p.post_id = m.post_id
JOIN tickers t ON m.ticker_id = t.id
JOIN subreddits s ON p.subreddit_id = s.id
WHERE t.symbol = ?
WHERE LOWER(t.symbol) = LOWER(?)
ORDER BY p.post_timestamp DESC;
"""
results = conn.execute(query, (ticker_symbol,)).fetchall()
@@ -346,7 +346,7 @@ def get_subreddit_summary(subreddit_name, limit=50):
FROM mentions m
JOIN tickers t ON m.ticker_id = t.id
JOIN subreddits s ON m.subreddit_id = s.id
WHERE s.name = ?
WHERE LOWER(s.name) = LOWER(?)
GROUP BY t.symbol, t.market_cap, t.closing_price
ORDER BY mention_count DESC LIMIT ?;
"""
@@ -366,7 +366,7 @@ def get_image_view_summary(subreddit_name):
FROM mentions m
JOIN tickers t ON m.ticker_id = t.id
JOIN subreddits s ON m.subreddit_id = s.id
WHERE s.name = ?
WHERE LOWER(s.name) = LOWER(?)
GROUP BY t.symbol
ORDER BY (post_mentions + comment_mentions) DESC
LIMIT 10;
@@ -389,7 +389,7 @@ def get_weekly_summary_for_subreddit(subreddit_name):
FROM mentions m
JOIN tickers t ON m.ticker_id = t.id
JOIN subreddits s ON m.subreddit_id = s.id
WHERE s.name = ? AND m.mention_timestamp >= ?
WHERE LOWER(s.name) = LOWER(?) AND m.mention_timestamp >= ?
GROUP BY t.symbol
ORDER BY (post_mentions + comment_mentions) DESC
LIMIT 10;