unread-counter-fix

This commit is contained in:
Untone 2024-01-23 12:20:45 +03:00
parent eae0603df3
commit b0e4a84a5e

View File

@ -1,4 +1,5 @@
from sqlalchemy.sql.operators import is_not
from services.db import local_session from services.db import local_session
from resolvers.model import ( from resolvers.model import (
NotificationReaction, NotificationReaction,
@ -66,7 +67,7 @@ async def get_notifications_grouped(author_id: int, after: int = 0, limit: int =
and_( and_(
Notification.action == NotificationAction.CREATE.value, Notification.action == NotificationAction.CREATE.value,
Notification.created_at > after, Notification.created_at > after,
or_(Notification.seen.is_(False), Notification.seen.is_(None)) is_not(Notification.seen)
) )
).count() ).count()
notifications_result = session.execute(query) notifications_result = session.execute(query)