only allow 1 post per throttled hole in WPD

pull/221/head
Aevann 2023-12-30 19:11:43 +02:00
parent 94366574de
commit 8116ba7b89
1 changed files with 7 additions and 2 deletions

View File

@ -144,8 +144,13 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
if SITE_NAME == 'WPD' and sort == "hot" and hole == None:
posts = posts.limit(200).all()
to_remove = [x.id for x in posts if x.hole in LIMITED_WPD_HOLES][3:]
posts = [x for x in posts if x.id not in to_remove][:size]
posts_in_limited_holes = [x for x in posts if x.hole in LIMITED_WPD_HOLES]
captured_holes = set()
for post in posts_in_limited_holes:
if len(captured_holes) < 3 and post.hole not in captured_holes:
captured_holes.add(post.hole)
else:
posts.remove(post)
elif SITE_NAME == 'WPD' and not v and hole == None:
posts = posts.limit(200).all()
posts = [x for x in posts if x.hole not in {'pets','selfharm'}][:size]