From b0e4a84a5ebd08a31701c225b1f0a0a52ae8bfdb Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 23 Jan 2024 12:20:45 +0300 Subject: [PATCH] unread-counter-fix --- resolvers/load.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resolvers/load.py b/resolvers/load.py index 54bad15..5f05f05 100644 --- a/resolvers/load.py +++ b/resolvers/load.py @@ -1,4 +1,5 @@ +from sqlalchemy.sql.operators import is_not from services.db import local_session from resolvers.model import ( NotificationReaction, @@ -66,7 +67,7 @@ async def get_notifications_grouped(author_id: int, after: int = 0, limit: int = and_( Notification.action == NotificationAction.CREATE.value, Notification.created_at > after, - or_(Notification.seen.is_(False), Notification.seen.is_(None)) + is_not(Notification.seen) ) ).count() notifications_result = session.execute(query)