fd
This commit is contained in:
parent
f7d0dfff2d
commit
3fa266f8ac
2 changed files with 8 additions and 3 deletions
|
@ -49,9 +49,9 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
stickied = Column(Boolean, default=False)
|
stickied = Column(Boolean, default=False)
|
||||||
is_pinned = Column(Boolean, default=False)
|
is_pinned = Column(Boolean, default=False)
|
||||||
private = Column(Boolean, default=False)
|
private = Column(Boolean, default=False)
|
||||||
_comments = relationship(
|
comments = relationship(
|
||||||
"Comment",
|
"Comment",
|
||||||
lazy="dynamic",
|
lazy="joined",
|
||||||
primaryjoin="Comment.parent_submission==Submission.id",
|
primaryjoin="Comment.parent_submission==Submission.id",
|
||||||
backref="submissions")
|
backref="submissions")
|
||||||
flags = relationship("Flag", lazy="dynamic")
|
flags = relationship("Flag", lazy="dynamic")
|
||||||
|
@ -77,6 +77,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
primaryjoin="Submission.is_approved==User.id")
|
primaryjoin="Submission.is_approved==User.id")
|
||||||
|
|
||||||
awards = relationship("AwardRelationship", lazy="joined")
|
awards = relationship("AwardRelationship", lazy="joined")
|
||||||
|
scoresex = deferred(Column(Float, server_default=FetchedValue()))
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,13 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words=''
|
||||||
elif sort == "controversial":
|
elif sort == "controversial":
|
||||||
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||||
elif sort == "top":
|
elif sort == "top":
|
||||||
|
time1 = time.time()
|
||||||
posts = sorted(posts.all(), key=lambda x: x.score, reverse=True)
|
posts = sorted(posts.all(), key=lambda x: x.score, reverse=True)
|
||||||
|
print(time.time() - time1)
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
posts = sorted(posts.all(), key=lambda x: x.score)
|
time1 = time.time()
|
||||||
|
posts = posts.order_by(Submission.sexscore.desc()).all()
|
||||||
|
print(time.time() - time1)
|
||||||
elif sort == "comments":
|
elif sort == "comments":
|
||||||
posts = posts.order_by(Submission.comment_count.desc()).all()
|
posts = posts.order_by(Submission.comment_count.desc()).all()
|
||||||
elif sort == "random":
|
elif sort == "random":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue