fd
This commit is contained in:
parent
401290173e
commit
57432859d4
2 changed files with 2 additions and 7 deletions
|
@ -77,7 +77,6 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
|||
primaryjoin="Submission.is_approved==User.id")
|
||||
|
||||
awards = relationship("AwardRelationship", lazy="joined")
|
||||
sexscore = deferred(Column(Float, server_default=FetchedValue()))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ def notifications(v):
|
|||
render_replies=True,
|
||||
is_notification_page=True)
|
||||
|
||||
# @cache.memoize(timeout=1500)
|
||||
@cache.memoize(timeout=1500)
|
||||
def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words='', **kwargs):
|
||||
|
||||
posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False,stickied=False,private=False).filter(Submission.deleted_utc == 0)
|
||||
|
@ -126,13 +126,9 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words=''
|
|||
elif sort == "controversial":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
elif sort == "top":
|
||||
time1 = time.time()
|
||||
posts = sorted(posts.all(), key=lambda x: x.score, reverse=True)
|
||||
print("list " + str(time.time() - time1))
|
||||
elif sort == "bottom":
|
||||
time1 = time.time()
|
||||
posts = posts.order_by(Submission.sexscore.desc()).all()
|
||||
print("func " + str(time.time() - time1))
|
||||
posts = sorted(posts.all(), key=lambda x: x.score)
|
||||
elif sort == "comments":
|
||||
posts = posts.order_by(Submission.comment_count.desc()).all()
|
||||
elif sort == "random":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue