Skip to content

Commit

Permalink
fix: lower thresholds for best comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vas3k committed Sep 19, 2023
1 parent b55b1b2 commit b8fb4fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions notifications/management/commands/send_best_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

TELEGRAM_CHANNEL_ID = -1001814814883
TIME_INTERVAL = timedelta(days=3)
LIMIT = 20
MIN_UPVOTES = 25
LIMIT = 30
MIN_UPVOTES = 15


class Command(BaseCommand):
Expand All @@ -22,11 +22,14 @@ class Command(BaseCommand):
def handle(self, *args, **options):
best_comments = Comment.visible_objects().filter(
created_at__gte=datetime.utcnow() - TIME_INTERVAL,
post__is_approved_by_moderator=True,
upvotes__gte=MIN_UPVOTES,
).order_by("-upvotes")[:LIMIT]

for comment in best_comments:
if comment.text.startswith("!"):
# skip images/memes
continue

if not comment.metadata or not comment.metadata.get("in_best_comments"):
self.stdout.write(f"Comment {comment.id} +{comment.upvotes}")
comment.metadata = comment.metadata or {}
Expand Down

0 comments on commit b8fb4fd

Please sign in to comment.