diff --git a/api/chalicelib/core/notifications.py b/api/chalicelib/core/notifications.py index c3eadcccd..1fc9a6508 100644 --- a/api/chalicelib/core/notifications.py +++ b/api/chalicelib/core/notifications.py @@ -29,7 +29,7 @@ def get_all_count(tenant_id, user_id): with pg_client.PostgresClient() as cur: cur.execute( cur.mogrify("""\ - SELECT COUNT(notifications.*) AS count + SELECT COALESCE(COUNT(notifications.*),0) AS count FROM public.notifications LEFT JOIN (SELECT notification_id FROM public.user_viewed_notifications diff --git a/ee/api/chalicelib/core/notifications.py b/ee/api/chalicelib/core/notifications.py index b552925e1..7562457a4 100644 --- a/ee/api/chalicelib/core/notifications.py +++ b/ee/api/chalicelib/core/notifications.py @@ -40,7 +40,7 @@ def get_all_count(tenant_id, user_id): {"tenant_id": tenant_id, "user_id": user_id}) ) row = cur.fetchone() - return row.get("count", 0) if row is not None else 0 + return row def view_notification(user_id, notification_ids=[], tenant_id=None, startTimestamp=None, endTimestamp=None):