This commit is contained in:
Aevann1 2021-09-22 17:23:57 +02:00
parent 3f9076342f
commit 7c23eea71c
6 changed files with 31 additions and 12 deletions

View file

@ -114,8 +114,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = g.db.query(Submission).options(lazyload('*'))
if t != 'all':
cutoff = 0
if t != 'day' and sort in ["hot","controversial"]:
cutoff = int(time.time()) - 86400
posts = posts.filter(Submission.created_utc >= cutoff)
elif t != 'all':
now = int(time.time())
if t == 'hour':
cutoff = now - 3600