This commit is contained in:
Aevann1 2021-11-05 22:10:51 +02:00
parent cc8a75e086
commit 2a557154b0
4 changed files with 24 additions and 5 deletions

View file

@ -65,6 +65,7 @@ class Comment(Base):
return f"<Comment(id={self.id})>"
@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):