From 7d426ee79a4334c49c6c25677f0039b282ab6e73 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Tue, 7 Jun 2022 18:18:22 +0200 Subject: [PATCH] feat(api): fixed notifications count query --- api/chalicelib/core/notifications.py | 4 +--- ee/api/chalicelib/core/notifications.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/chalicelib/core/notifications.py b/api/chalicelib/core/notifications.py index ce3c4d61a..c3eadcccd 100644 --- a/api/chalicelib/core/notifications.py +++ b/api/chalicelib/core/notifications.py @@ -34,9 +34,7 @@ def get_all_count(tenant_id, user_id): LEFT JOIN (SELECT notification_id FROM public.user_viewed_notifications WHERE user_viewed_notifications.user_id = %(user_id)s) AS user_viewed_notifications USING (notification_id) - WHERE (notifications.user_id IS NULL OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL - ORDER BY created_at DESC - LIMIT 100;""", + WHERE (notifications.user_id IS NULL OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL;""", {"user_id": user_id}) ) row = cur.fetchone() diff --git a/ee/api/chalicelib/core/notifications.py b/ee/api/chalicelib/core/notifications.py index 5ba58f242..0069063c7 100644 --- a/ee/api/chalicelib/core/notifications.py +++ b/ee/api/chalicelib/core/notifications.py @@ -36,9 +36,7 @@ def get_all_count(tenant_id, user_id): FROM public.user_viewed_notifications WHERE user_viewed_notifications.user_id = %(user_id)s) AS user_viewed_notifications USING (notification_id) WHERE (notifications.tenant_id =%(tenant_id)s - OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL - ORDER BY created_at DESC - LIMIT 100;""", + OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL;""", {"tenant_id": tenant_id, "user_id": user_id}) ) rows = helper.list_to_camel_case(cur.fetchall())