forked from rDrama/rDrama
fddf
parent
a47f561377
commit
b22b261380
|
@ -338,20 +338,15 @@ class User(Base):
|
||||||
|
|
||||||
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
||||||
|
|
||||||
@property
|
|
||||||
@lazy
|
|
||||||
def unread_notifications(self):
|
|
||||||
return g.db.query(Notification.id).options(lazyload('*')).filter(Notification.user_id == self.id, Notification.read == False).join(Notification.comment)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def notifications_count(self):
|
def notifications_count(self):
|
||||||
return self.unread_notifications.filter(Comment.is_banned == False, Comment.deleted_utc == 0).count()
|
return g.db.query(Notification.id, Comment.is_banned, Comment.deleted_utc).options(lazyload('*')).join(Comment).filter(Notification.user_id == self.id, Notification.read == False, Comment.is_banned == False, Comment.deleted_utc == 0).count()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def post_notifications_count(self):
|
def post_notifications_count(self):
|
||||||
return self.unread_notifications.filter(Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
return g.db.query(Notification.id, Comment.author_id).options(lazyload('*')).join(Comment).filter(Notification.user_id == self.id, Notification.read == False, Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue