grugposting
This commit is contained in:
parent
7198fe2a60
commit
c645afc085
1 changed files with 8 additions and 5 deletions
|
@ -340,16 +340,19 @@ class User(Base):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def post_notifications_count(self):
|
def unread_notifications(self):
|
||||||
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
return g.db.query(Notification.id).options(lazyload('*')).filter(Notification.user_id == self.id, Notification.read == False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def notifications_count(self):
|
def notifications_count(self):
|
||||||
|
return self.unread_notifications.count()
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def post_notifications_count(self):
|
||||||
|
return self.unread_notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
||||||
|
|
||||||
return self.notifications.join(Notification.comment).filter(Notification.read == False,
|
|
||||||
Comment.is_banned == False,
|
|
||||||
Comment.deleted_utc == 0).count()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue