This commit is contained in:
parent
940fb121e4
commit
aa7e0f9cfc
|
@ -55,10 +55,10 @@ async def get_notifications_grouped(author_id: int, after: int = 0, limit: int =
|
||||||
notifications_by_thread: Dict[str, List[Notification]] = {}
|
notifications_by_thread: Dict[str, List[Notification]] = {}
|
||||||
groups_by_thread: Dict[str, NotificationGroup] = {}
|
groups_by_thread: Dict[str, NotificationGroup] = {}
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
|
total = session.query(Notification).filter(and_(Notification.action == "create", Notification.created_at > after)).count()
|
||||||
|
unread = session.query(Notification).filter(and_(Notification.action == "create", Notification.created_at > after, Notification.seen.is_not(True))).count()
|
||||||
notifications_result = session.execute(query)
|
notifications_result = session.execute(query)
|
||||||
for n, seen in notifications_result:
|
for n, seen in notifications_result:
|
||||||
total += 1
|
|
||||||
unread += 1 if author_id in n.seen else 0
|
|
||||||
thread_id = ""
|
thread_id = ""
|
||||||
payload = json.loads(n.payload)
|
payload = json.loads(n.payload)
|
||||||
print(f"[resolvers.schema] {n.action} {n.entity}: {payload}")
|
print(f"[resolvers.schema] {n.action} {n.entity}: {payload}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user