diff --git a/files/classes/comment.py b/files/classes/comment.py index c9f9e330f..4dc99bdc9 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -276,20 +276,29 @@ class Comment(Base): for o in self.options: input_type = 'radio' if o.exclusive else 'checkbox' - body += f'
''' + option_body += f'''>''' + + if o.exclusive > 1: s = '!!' + elif o.exclusive: s = '&&' + else: s = '$$' + + if f'{s}{o.body}{s}' in body: + body = body.replace(f'{s}{o.body}{s}', option_body) + else: + body += option_body if not self.ghost and self.author.show_sig(v): body += f' ' diff --git a/files/classes/polls.py b/files/classes/polls.py index c640fde41..3578b4219 100644 --- a/files/classes/polls.py +++ b/files/classes/polls.py @@ -11,7 +11,8 @@ class SubmissionOption(Base): __tablename__ = "submission_options" id = Column(Integer, primary_key=True) - submission_id = Column(Integer, ForeignKey("submissions.id")) + parent_id = Column(Integer, ForeignKey("submissions.id")) + body = Column(Text) body_html = Column(Text) exclusive = Column(Integer) created_utc = Column(Integer) @@ -66,7 +67,8 @@ class CommentOption(Base): __tablename__ = "comment_options" id = Column(Integer, primary_key=True) - comment_id = Column(Integer, ForeignKey("comments.id")) + parent_id = Column(Integer, ForeignKey("comments.id")) + body = Column(Text) body_html = Column(Text) exclusive = Column(Integer) created_utc = Column(Integer) diff --git a/files/classes/submission.py b/files/classes/submission.py index c4f1f00ab..489818a1f 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -285,39 +285,49 @@ class Submission(Base): winner = [x for x in self.options if x.exclusive == 3] for o in self.options: - if o.exclusive > 1: - body += f'''