From 568a3700f01a905c5dc196c2147de131f1bbd055 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 18 Sep 2021 21:56:44 +0200 Subject: [PATCH] fds --- files/routes/votes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/routes/votes.py b/files/routes/votes.py index fd11176a2..74b74f805 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -96,6 +96,7 @@ def api_vote_post(post_id, new, v): ) g.db.add(vote) + g.db.flush() post.upvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=1).count() post.downvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=-1).count() g.db.add(post) @@ -148,7 +149,8 @@ def api_vote_comment(comment_id, new, v): ) g.db.add(vote) - + + g.db.flush() comment.upvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=1).count() comment.downvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=-1).count() g.db.add(comment)