From b0511a1b8565ce470191b2002395cb1f5523fb3e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 18 Sep 2021 21:53:43 +0200 Subject: [PATCH] dfsfds --- files/routes/comments.py | 4 ++-- files/routes/votes.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index f28f13a5d..6b59a5a5c 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -896,7 +896,7 @@ def save_comment(cid, v): comment=get_comment(cid) - save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=comment.id, type=2).first() + save=g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=comment.id, type=2).first() if not save: new_save=SaveRelationship(user_id=v.id, submission_id=comment.id, type=2) @@ -912,7 +912,7 @@ def unsave_comment(cid, v): comment=get_comment(cid) - save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=comment.id, type=2).first() + save=g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=comment.id, type=2).first() if save: g.db.delete(save) diff --git a/files/routes/votes.py b/files/routes/votes.py index fd11176a2..3be315e7a 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -69,7 +69,7 @@ def api_vote_post(post_id, new, v): post = get_post(post_id) # check for existing vote - existing = g.db.query(Vote).options(lazyload('*')).filter_by(user_id=v.id, submission_id=post.id).first() + existing = g.db.query(Vote).filter_by(user_id=v.id, submission_id=post.id).first() if existing and existing.vote_type == new: return "", 204 @@ -96,8 +96,8 @@ def api_vote_post(post_id, new, v): ) g.db.add(vote) - 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() + 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() g.db.add(post) g.db.commit() return "", 204 @@ -121,7 +121,7 @@ def api_vote_comment(comment_id, new, v): comment = get_comment(comment_id) # check for existing vote - existing = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id, comment_id=comment.id).first() + existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).first() if existing and existing.vote_type == new: return "", 204 @@ -149,8 +149,8 @@ def api_vote_comment(comment_id, new, v): g.db.add(vote) - 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() + comment.upvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=1).count() + comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count() g.db.add(comment) g.db.commit() return "", 204 \ No newline at end of file