From b23e470317eb82e59874ab8d684dd8f7d1bc5064 Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Mon, 16 Nov 2020 10:11:39 +1300 Subject: [PATCH] move reddit thresholds as settings variables. --- apiserver/feeds/reddit.py | 2 +- apiserver/settings.py.example | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apiserver/feeds/reddit.py b/apiserver/feeds/reddit.py index 3268066..7742795 100644 --- a/apiserver/feeds/reddit.py +++ b/apiserver/feeds/reddit.py @@ -73,7 +73,7 @@ def story(ref): s['comments'] = list(filter(bool, s['comments'])) s['num_comments'] = r.num_comments - if s['score'] < 25 and s['num_comments'] < 10: + if s['score'] < settings.REDDIT_SCORE_THRESHOLD and s['num_comments'] < settings.REDDIT_COMMENT_THRESHOLD: return False if r.selftext: diff --git a/apiserver/settings.py.example b/apiserver/settings.py.example index 62cec23..ade6040 100644 --- a/apiserver/settings.py.example +++ b/apiserver/settings.py.example @@ -31,6 +31,10 @@ REDDIT_CLIENT_ID = '' REDDIT_CLIENT_SECRET = '' REDDIT_USER_AGENT = '' +# Minimum points or number of comments before including a thread: +REDDIT_COMMENT_THRESHOLD = 10 +REDDIT_SCORE_THRESHOLD = 25 + SUBREDDITS = [ 'Economics', 'AcademicPhilosophy',