diff --git a/files/classes/comment.py b/files/classes/comment.py index f7f13c065..51b9d2578 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -51,10 +51,10 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): oauth_app=relationship("OauthApp") post = relationship("Submission") - flags = relationship("CommentFlag", lazy="joined") + flags = relationship("CommentFlag", lazy="dynamic") votes = relationship( "CommentVote", - lazy="joined", + lazy="dynamic", primaryjoin="CommentVote.comment_id==Comment.id") author = relationship( @@ -293,7 +293,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): @property @lazy - def active_flags(self): return len(self.flags) + def active_flags(self): return self.flags.count() @property @lazy diff --git a/files/classes/submission.py b/files/classes/submission.py index 0f9bca342..7d2111423 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -54,7 +54,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): lazy="joined", primaryjoin="Comment.parent_submission==Submission.id", ) - flags = relationship("Flag", lazy="joined") + flags = relationship("Flag", lazy="dynamic") is_approved = Column(Integer, ForeignKey("users.id"), default=0) over_18 = Column(Boolean, default=False) author = relationship( @@ -415,7 +415,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): @property @lazy - def active_flags(self): return len(self.flags) + def active_flags(self): return self.flags.count() @property @lazy