remotes/1693045480750635534/spooky-22
Aevann1 2021-11-30 16:23:34 +02:00
parent 63f09542e5
commit c436424bd1
8 changed files with 13 additions and 14 deletions

View File

@ -251,7 +251,7 @@ class User(Base):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.realdownvotes)
elif sort == "top":
posts = posts.order_by(Submission.realdownvotes - Submission.realupvotes)
elif sort == "bottom":

View File

@ -13,7 +13,7 @@ class Vote(Base):
vote_type = Column(Integer)
submission_id = Column(Integer, ForeignKey("submissions.id"))
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
real = Column(Boolean)
real = Column(Boolean, default=True)
user = relationship("User", lazy="subquery", viewonly=True)
post = relationship("Submission", lazy="subquery", viewonly=True)
@ -54,7 +54,7 @@ class CommentVote(Base):
vote_type = Column(Integer)
comment_id = Column(Integer, ForeignKey("comments.id"))
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
real = Column(Boolean)
real = Column(Boolean, default=True)
user = relationship("User", lazy="subquery", viewonly=True)
comment = relationship("Comment", lazy="subquery", viewonly=True)

View File

@ -401,7 +401,7 @@ def api_comment(v):
g.db.add(n)
if v.id == PIZZA_SHILL_ID:
cratvote = CommentVote(user_id=TAX_RECEIVER_ID, comment_id=c.id, vote_type=1, real=True)
cratvote = CommentVote(user_id=TAX_RECEIVER_ID, comment_id=c.id, vote_type=1)
g.db.add(cratvote)
v.coins += 1
v.truecoins += 1
@ -585,7 +585,6 @@ def api_comment(v):
vote = CommentVote(user_id=v.id,
comment_id=c.id,
vote_type=1,
real=True
)
g.db.add(vote)

View File

@ -243,7 +243,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.realdownvotes)
elif sort == "top":
posts = posts.order_by(Submission.realdownvotes - Submission.realupvotes)
elif sort == "bottom":
@ -340,7 +340,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.realdownvotes)
elif sort == "top":
posts = posts.order_by(Submission.realdownvotes - Submission.realupvotes)
elif sort == "bottom":
@ -407,7 +407,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.realdownvotes)
elif sort == "top":
comments = comments.order_by(Comment.realdownvotes - Comment.realupvotes)
elif sort == "bottom":

View File

@ -167,7 +167,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.realdownvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
elif sort == "bottom":
@ -191,7 +191,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.realdownvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
elif sort == "bottom":

View File

@ -131,7 +131,7 @@ def searchposts(v):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.realupvotes * Submission.realdownvotes * Submission.realdownvotes)
elif sort == "top":
posts = posts.order_by(Submission.realdownvotes - Submission.realupvotes)
elif sort == "bottom":
@ -230,7 +230,7 @@ def searchcomments(v):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.realdownvotes)
elif sort == "top":
comments = comments.order_by(Comment.realdownvotes - Comment.realupvotes)
elif sort == "bottom":

View File

@ -690,7 +690,7 @@ def u_username_comments(username, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.realdownvotes)
elif sort == "top":
comments = comments.order_by(Comment.realdownvotes - Comment.realupvotes)
elif sort == "bottom":

View File

@ -216,7 +216,7 @@ def api_vote_poll(comment_id, v):
g.db.add(existing)
else: g.db.delete(existing)
elif new == 1:
vote = CommentVote(user_id=v.id, vote_type=new, comment_id=comment.id, real=True)
vote = CommentVote(user_id=v.id, vote_type=new, comment_id=comment.id)
g.db.add(vote)
try: