remotes/1693045480750635534/spooky-22
Aevann1 2021-09-25 03:47:10 +02:00
parent 984cab8ca9
commit 832b7f8ce4
1 changed files with 7 additions and 4 deletions

View File

@ -150,13 +150,11 @@ def front_all(v):
#@cache.memoize(timeout=86400)
@cache.memoize(timeout=86400)
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
posts = g.db.query(Submission.id).options(lazyload('*'))
print(posts.all())
if 'rdrama' in request.host and sort == "hot":
cutoff = int(time.time()) - 86400
posts = posts.filter(Submission.created_utc >= cutoff)
@ -172,7 +170,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
cutoff = now - 2592000
elif t == 'year':
cutoff = now - 31536000
print(cutoff)
posts = posts.filter(Submission.created_utc >= cutoff)
posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
@ -201,6 +198,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
for word in filter_words:
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
gt = kwargs.get("gt")
lt = kwargs.get("lt")
if not (v and v.shadowbanned):
posts = posts.join(Submission.author).filter(User.shadowbanned == False)
@ -295,6 +295,9 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
cutoff = now - 31536000
posts = posts.filter(Submission.created_utc >= cutoff)
gt = kwargs.get("gt")
lt = kwargs.get("lt")
if sort == "new":
posts = posts.order_by(Submission.created_utc.desc())
elif sort == "old":