From e34cbeca3138c6997c7aa711d180666f6f0207be Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 26 Jun 2022 03:25:17 +0200 Subject: [PATCH] fix 3b8188fd675490f2aef60697c79274d699993094 --- files/classes/comment.py | 4 ++-- files/classes/submission.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 7cb0d6137..3ccf1c0e7 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -134,7 +134,7 @@ class Comment(Base): @lazy def total_choice_voted(self, v): if v: - return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).count() + return g.db.query(CommentVote.comment_id).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).first() return False @property @@ -423,7 +423,7 @@ class Comment(Base): if self.choices: curr = self.total_choice_voted(v) - if curr: curr = " value=" + str(curr[0].comment_id) + if curr: curr = " value=" + str(curr.comment_id) else: curr = '' body += f'' diff --git a/files/classes/submission.py b/files/classes/submission.py index a9a7abe22..584259fb2 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -127,7 +127,7 @@ class Submission(Base): @lazy def total_choice_voted(self, v): if v and self.choices: - return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).count() + return g.db.query(CommentVote.comment_id).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).first() return False @lazy @@ -417,7 +417,7 @@ class Submission(Base): if self.choices: curr = self.total_choice_voted(v) - if curr: curr = " value=" + str(curr[0].comment_id) + if curr: curr = " value=" + str(curr.comment_id) else: curr = '' body += f''