From 2075e3c322e3eca52e917d955771c8d1a439d606 Mon Sep 17 00:00:00 2001 From: Aevann1 <59999695+Aevann1@users.noreply.github.com> Date: Sun, 25 Jul 2021 00:34:34 +0200 Subject: [PATCH] Update user.py --- drama/classes/user.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drama/classes/user.py b/drama/classes/user.py index d690d5c156..a7839d1c61 100644 --- a/drama/classes/user.py +++ b/drama/classes/user.py @@ -177,8 +177,12 @@ class User(Base, Stndrd, Age_times): @property @lazy def dramacoins(self): - posts = sum([x.upvotes + x.downvotes - 1 for x in g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False, deleted_utc=0).all()]) - comments = sum([x.upvotes + x.downvotes - 1 for x in g.db.query(Comment).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False, deleted_utc=0).all()]) + posts = sum([x[0] - 1 for x in + g.db.query(Submission.score).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False, + deleted_utc=0).all()]) + comments = sum([x[0] - 1 for x in + g.db.query(Comment.score).options(lazyload('*')).filter_by(author_id=self.id, is_banned=False, + deleted_utc=0).all()]) return int(posts + comments) def has_block(self, target): @@ -1012,4 +1016,4 @@ class ViewerRelationship(Base): return f"{months}mo ago" else: years = int(months / 12) - return f"{years}yr ago" \ No newline at end of file + return f"{years}yr ago"