Remove games.
Unfortunately not totally dead code paths, and special case behavior for them complicated commenting and sorting logic in a number of places.
This commit is contained in:
parent
3e8904757a
commit
70c8a942b6
10 changed files with 72 additions and 536 deletions
|
@ -5,7 +5,6 @@ from files.helpers.sanitize import *
|
|||
from files.helpers.alerts import *
|
||||
from files.helpers.discord import send_discord_message, send_cringetopia_message
|
||||
from files.helpers.const import *
|
||||
from files.helpers.slots import *
|
||||
from files.classes import *
|
||||
from flask import *
|
||||
from io import BytesIO
|
||||
|
@ -209,9 +208,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
first = [c[0] for c in comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()]
|
||||
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
|
||||
comments = first + second
|
||||
comments = [c[0] for c in comments.all()]
|
||||
else:
|
||||
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
|
||||
|
||||
|
@ -228,9 +225,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
first = comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()
|
||||
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()
|
||||
comments = first + second
|
||||
comments = comments.all()
|
||||
|
||||
offset = 0
|
||||
ids = set()
|
||||
|
@ -344,9 +339,7 @@ def viewmore(v, pid, sort, offset):
|
|||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
first = [c[0] for c in comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()]
|
||||
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()]
|
||||
comments = first + second
|
||||
comments = [c[0] for c in comments.all()]
|
||||
else:
|
||||
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.level == 1, Comment.is_pinned == None, Comment.id.notin_(ids))
|
||||
|
||||
|
@ -360,10 +353,8 @@ def viewmore(v, pid, sort, offset):
|
|||
comments = comments.order_by(Comment.realupvotes.desc())
|
||||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
first = comments.filter(or_(and_(Comment.slots_result == None, Comment.blackjack_result == None, Comment.wordle_result == None), func.length(Comment.body_html) > 100)).all()
|
||||
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None, Comment.wordle_result != None), func.length(Comment.body_html) <= 100).all()
|
||||
comments = first + second
|
||||
|
||||
comments = comments.all()
|
||||
comments = comments[offset:]
|
||||
|
||||
comments2 = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue