diff --git a/resolvers/load.py b/resolvers/load.py index 6a71917..e6d8df0 100644 --- a/resolvers/load.py +++ b/resolvers/load.py @@ -55,10 +55,10 @@ async def get_notifications_grouped(author_id: int, after: int = 0, limit: int = notifications_by_thread: Dict[str, List[Notification]] = {} groups_by_thread: Dict[str, NotificationGroup] = {} 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) for n, seen in notifications_result: - total += 1 - unread += 1 if author_id in n.seen else 0 thread_id = "" payload = json.loads(n.payload) print(f"[resolvers.schema] {n.action} {n.entity}: {payload}")