From 4f314382acbd1b3dad2759282a26d7eefe6d6474 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 6 Jan 2022 21:05:13 +0200 Subject: [PATCH] sfd --- files/classes/comment.py | 6 +----- files/classes/submission.py | 9 +++------ files/templates/comments.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index b54f758a3..aad16a107 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -69,7 +69,7 @@ class Comment(Base): @property @lazy def flags(self): - return g.db.query(CommentFlag).filter_by(comment_id=self.id) + return g.db.query(CommentFlag).filter_by(comment_id=self.id).order_by(CommentFlag.id) @lazy def poll_voted(self, v): @@ -399,10 +399,6 @@ class Comment(Base): @lazy def active_flags(self): return self.flags.count() - @property - @lazy - def ordered_flags(self): return self.flags.order_by(CommentFlag.id).all() - def options_html(self, v): html = "" for o in self.options: diff --git a/files/classes/submission.py b/files/classes/submission.py index 209994680..287fd90bf 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -11,6 +11,7 @@ from files.helpers.const import AUTOPOLLER_ID, AUTOBETTER_ID, censor_slurs, TROL from files.helpers.lazy import lazy from .flags import Flag from .comment import Comment +from .award import AwardRelationship from flask import g site = environ.get("DOMAIN").strip() @@ -56,7 +57,7 @@ class Submission(Base): author = relationship("User", primaryjoin="Submission.author_id==User.id") oauth_app = relationship("OauthApp", viewonly=True) approved_by = relationship("User", uselist=False, primaryjoin="Submission.is_approved==User.id", viewonly=True) - awards = relationship("AwardRelationship", viewonly=True) + awards = relationship("AwardRelationship", viewonly=True, order_by=AwardRelationship.id.desc()) reports = relationship("Flag", viewonly=True) def __init__(self, *args, **kwargs): @@ -74,7 +75,7 @@ class Submission(Base): @property @lazy def flags(self): - return g.db.query(Flag).filter_by(post_id=self.id) + return g.db.query(Flag).filter_by(post_id=self.id).order_by(Flag.id) @property @lazy @@ -430,10 +431,6 @@ class Submission(Base): @lazy def active_flags(self): return self.flags.count() - @property - @lazy - def ordered_flags(self): return self.flags.order_by(Flag.id).all() - class SaveRelationship(Base): diff --git a/files/templates/comments.html b/files/templates/comments.html index d1087dcbd..f817cc1e6 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -228,7 +228,7 @@ Reported by:

 				
diff --git a/files/templates/submission.html b/files/templates/submission.html
index a13548d14..5fd5d0169 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -365,7 +365,7 @@
 						 Reported by:
 						

 						
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 056113bbd..2cce23699 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -85,7 +85,7 @@
 		 Reported by: