forked from rDrama/rDrama
1
0
Fork 0
Aevann1 2022-06-26 03:25:17 +02:00
parent 3b8188fd67
commit e34cbeca31
2 changed files with 4 additions and 4 deletions

View File

@ -134,7 +134,7 @@ class Comment(Base):
@lazy @lazy
def total_choice_voted(self, v): def total_choice_voted(self, v):
if 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 return False
@property @property
@ -423,7 +423,7 @@ class Comment(Base):
if self.choices: if self.choices:
curr = self.total_choice_voted(v) 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 = '' else: curr = ''
body += f'<input class="d-none" id="current-{self.id}"{curr}>' body += f'<input class="d-none" id="current-{self.id}"{curr}>'

View File

@ -127,7 +127,7 @@ class Submission(Base):
@lazy @lazy
def total_choice_voted(self, v): def total_choice_voted(self, v):
if v and self.choices: 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 return False
@lazy @lazy
@ -417,7 +417,7 @@ class Submission(Base):
if self.choices: if self.choices:
curr = self.total_choice_voted(v) 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 = '' else: curr = ''
body += f'<input class="d-none" id="current-{self.id}"{curr}>' body += f'<input class="d-none" id="current-{self.id}"{curr}>'