From c4ea7837b7018f236eca7a4ef3376d4eed08c5dd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 5 Nov 2021 22:10:51 +0200 Subject: [PATCH] fdsdfs --- files/classes/comment.py | 7 +++++++ files/classes/submission.py | 6 ++++++ files/templates/comments.html | 11 +++++++---- files/templates/submission.html | 5 ++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 83df5e300..5e78c46a5 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 9a3ac711b..7606e756a 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 58d982455..56af561b1 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -61,8 +61,11 @@