group-seen-fix-3
All checks were successful
deploy / deploy (push) Successful in 1m14s

This commit is contained in:
Untone 2023-12-22 18:44:22 +03:00
parent 940fb121e4
commit aa7e0f9cfc

View File

@ -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}")