diff --git a/files/classes/comment.py b/files/classes/comment.py index 83df5e3008..5e78c46a51 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -65,6 +65,7 @@ class Comment(Base): return f"" + @lazy def poll_voted(self, v): if v: vote = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id, comment_id=self.id).first() @@ -77,6 +78,12 @@ class Comment(Base): def options(self): return [x for x in self.child_comments if x.author_id == AUTOPOLLER_ACCOUNT] + def total_poll_voted(self, v): + if v: + for option in self.options: + if option.poll_voted(v): return True + return False + @property @lazy def created_datetime(self): diff --git a/files/classes/submission.py b/files/classes/submission.py index 9a3ac711bb..7606e756ad 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -78,6 +78,12 @@ class Submission(Base): def options(self): return self.comments.filter_by(author_id = AUTOPOLLER_ACCOUNT, level=1) + def total_poll_voted(self, v): + if v: + for option in self.options: + if option.poll_voted(v): return True + return False + @property @lazy def created_datetime(self): diff --git a/files/templates/comments.html b/files/templates/comments.html index 58d982455a..56af561b1f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -61,8 +61,11 @@