remotes/1693045480750635534/spooky-22
Aevann1 2021-08-01 10:26:44 +02:00
parent 8cda9dd166
commit 08e25791b4
1 changed files with 2 additions and 1 deletions

View File

@ -99,7 +99,8 @@ def api_vote_post(post_id, new, v):
) )
g.db.add(vote) g.db.add(vote)
g.db.flush() try: g.db.flush()
except: g.db.rollback()
post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count() post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count()
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count() post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
g.db.add(post) g.db.add(post)