gf
This commit is contained in:
parent
83bb091810
commit
627be92a7c
4 changed files with 31 additions and 58 deletions
|
@ -52,6 +52,7 @@ class User(Base, Stndrd, Age_times):
|
|||
passhash = deferred(Column(String))
|
||||
post_count = Column(Integer, default=0)
|
||||
comment_count = Column(Integer, default=0)
|
||||
received_award_count = Column(Integer, default=0)
|
||||
created_utc = Column(Integer, default=0)
|
||||
suicide_utc = Column(Integer, default=0)
|
||||
rent_utc = Column(Integer, default=0)
|
||||
|
@ -353,18 +354,6 @@ class User(Base, Stndrd, Age_times):
|
|||
|
||||
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def received_awards_num(self):
|
||||
|
||||
posts_idlist = g.db.query(Submission.id).filter_by(author_id=self.id).subquery()
|
||||
comments_idlist = g.db.query(Comment.id).filter_by(author_id=self.id).subquery()
|
||||
|
||||
post_awards = g.db.query(AwardRelationship).filter(AwardRelationship.submission_id.in_(posts_idlist)).count()
|
||||
comment_awards = g.db.query(AwardRelationship).filter(AwardRelationship.comment_id.in_(comments_idlist)).count()
|
||||
|
||||
return post_awards + comment_awards
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def post_notifications_count(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue