From b4fb188a79214989c96e21022b1058d660f5feac Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 4 Mar 2022 23:23:33 +0200 Subject: [PATCH 1/2] coned --- files/classes/comment.py | 8 ++++++-- files/classes/submission.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 8b3e6ec847..54d966589c 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 f32957f207..10214a80a5 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 From e0d602bd1b223e3cc5c61fa07bfdee88d52c0ed4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 4 Mar 2022 23:26:35 +0200 Subject: [PATCH 2/2] deviants --- files/classes/submission.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 10214a80a5..9e81d26500 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -88,15 +88,13 @@ class Submission(Base): @property @lazy def options(self): - 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) + return g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOPOLLER_ID, level=1).order_by(Comment.id) @property @lazy def choices(self): - 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) + return g.db.query(Comment).filter_by(parent_submission = self.id, author_id = AUTOCHOICE_ID, level=1).order_by(Comment.id) @property