From a226496408fdb74ddaac5622672bc0cce76d1821 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sun, 21 Nov 2021 21:12:42 -0600 Subject: [PATCH] Fix DB query bug --- chat_box/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chat_box/views.py b/chat_box/views.py index 95a3582..08a2a9e 100644 --- a/chat_box/views.py +++ b/chat_box/views.py @@ -403,6 +403,7 @@ def get_unread_count(rooms, user): mess = Message.objects.filter(room__isnull=True, time__gte=OuterRef('last_seen'))\ .exclude(author=user)\ + .order_by().values('room')\ .annotate(unread_count=Count('pk')).values('unread_count') return UserRoom.objects\