remotes/1693045480750635534/spooky-22
Aevann1 2021-08-06 14:47:25 +02:00
parent 10fdaca089
commit e5f018ff39
3 changed files with 5 additions and 5 deletions

View File

@ -135,7 +135,7 @@ class User(Base, Stndrd, Age_times):
@property @property
@lazy @lazy
def referral_count(self): def referral_count(self):
return self.referrals.count() return len(self.referrals)
def has_block(self, target): def has_block(self, target):
@ -196,7 +196,7 @@ class User(Base, Stndrd, Age_times):
elif sort == "bottom": elif sort == "bottom":
submissions = sorted(submissions.all(), key=lambda x: x.score) submissions = sorted(submissions.all(), key=lambda x: x.score)
elif sort == "comments": elif sort == "comments":
submissions = submissions.order_by(Submission.comment_count.desc()).all() submissions = sorted(submissions.all(), key=lambda x: x.comment_count, reverse=True)
firstrange = 25 * (page - 1) firstrange = 25 * (page - 1)
secondrange = firstrange + 26 secondrange = firstrange + 26

View File

@ -130,7 +130,7 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words=''
elif sort == "bottom": elif sort == "bottom":
posts = sorted(posts.all(), key=lambda x: x.score) posts = sorted(posts.all(), key=lambda x: x.score)
elif sort == "comments": elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc()).all() posts = sorted(posts.all(), key=lambda x: x.comment_count, reverse=True)
elif sort == "random": elif sort == "random":
posts = posts.all() posts = posts.all()
posts = random.sample(posts, k=len(posts)) posts = random.sample(posts, k=len(posts))
@ -274,7 +274,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
elif sort == "bottom": elif sort == "bottom":
posts = sorted(posts.all(), key=lambda x: x.score) posts = sorted(posts.all(), key=lambda x: x.score)
elif sort == "comments": elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc()).all() posts = sorted(posts.all(), key=lambda x: x.comment_count, reverse=True)
elif sort == "random": elif sort == "random":
posts = posts.all() posts = posts.all()
posts = random.sample(posts, k=len(posts)) posts = random.sample(posts, k=len(posts))

View File

@ -128,7 +128,7 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
elif sort == "bottom": elif sort == "bottom":
posts = sorted(posts.all(), key=lambda x: x.score) posts = sorted(posts.all(), key=lambda x: x.score)
elif sort == "comments": elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc()).all() posts = sorted(posts.all(), key=lambda x: x.comment_count, reverse=True)
elif sort == "random": elif sort == "random":
posts = posts.all() posts = posts.all()
posts = random.sample(posts, k=len(posts)) posts = random.sample(posts, k=len(posts))