diff --git a/files/classes/comment.py b/files/classes/comment.py index 8b3e6ec84..54d966589 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -86,12 +86,16 @@ class Comment(Base): @property @lazy def options(self): - return [x for x in self.child_comments if x.author_id == AUTOPOLLER_ID] + li = [x for x in self.child_comments if x.author_id == AUTOPOLLER_ID] + return sorted(li, key=lambda x: x.id) + @property @lazy def choices(self): - return [x for x in self.child_comments if x.author_id == AUTOCHOICE_ID] + li = [x for x in self.child_comments if x.author_id == AUTOCHOICE_ID] + return sorted(li, key=lambda x: x.id) + def total_poll_voted(self, v): if v: diff --git a/files/classes/submission.py b/files/classes/submission.py index f32957f20..10214a80a 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -88,12 +88,16 @@ class Submission(Base): @property @lazy def options(self): - return g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOPOLLER_ID, level=1) + li = g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOPOLLER_ID, level=1) + return sorted(li, key=lambda x: x.id) + @property @lazy def choices(self): - return g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOCHOICE_ID, level=1) + li = g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOCHOICE_ID, level=1) + return sorted(li, key=lambda x: x.id) + @property @lazy