fix 500 error

master
Aevann 2024-02-18 22:07:22 +02:00
parent 4e5766d454
commit b0976c5f54
1 changed files with 6 additions and 2 deletions

View File

@ -166,7 +166,6 @@ def upvoters_downvoters(v, username, username2, cls, vote_cls, vote_dir, templat
page = get_page()
listing = g.db.query(cls).options(load_only(cls.id)).join(vote_cls).filter(
cls.draft == False,
cls.ghost == False,
cls.is_banned == False,
cls.deleted_utc == 0,
@ -175,6 +174,9 @@ def upvoters_downvoters(v, username, username2, cls, vote_cls, vote_dir, templat
vote_cls.user_id == uid,
)
if cls == Post:
listing = listing.filter_by(private=False)
total = listing.count()
listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all()
@ -230,7 +232,6 @@ def upvoting_downvoting(v, username, username2, cls, vote_cls, vote_dir, templat
page = get_page()
listing = g.db.query(cls).options(load_only(cls.id)).join(vote_cls).filter(
cls.draft == False,
cls.ghost == False,
cls.is_banned == False,
cls.deleted_utc == 0,
@ -239,6 +240,9 @@ def upvoting_downvoting(v, username, username2, cls, vote_cls, vote_dir, templat
cls.author_id == uid,
)
if cls == Post:
listing = listing.filter_by(private=False)
total = listing.count()
listing = listing.order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all()