From 79f33a670a3fb0ffec95914edf45c0a338fdb4bf Mon Sep 17 00:00:00 2001 From: Ahtisham Shahid Date: Fri, 28 Mar 2025 18:13:20 +0500 Subject: [PATCH] fix: notification count only for web (#36459) --- openedx/core/djangoapps/notifications/tests/test_views.py | 1 + openedx/core/djangoapps/notifications/views.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/notifications/tests/test_views.py b/openedx/core/djangoapps/notifications/tests/test_views.py index 3e68ff2ce8..952cda06d5 100644 --- a/openedx/core/djangoapps/notifications/tests/test_views.py +++ b/openedx/core/djangoapps/notifications/tests/test_views.py @@ -793,6 +793,7 @@ class NotificationCountViewSetTestCase(ModuleStoreTestCase): Notification.objects.create(user=self.user, app_name='App Name 1', notification_type='Type B') Notification.objects.create(user=self.user, app_name='App Name 2', notification_type='Type A') Notification.objects.create(user=self.user, app_name='App Name 3', notification_type='Type C') + Notification.objects.create(user=self.user, app_name='App Name 4', notification_type='Type D', web=False) @override_waffle_flag(ENABLE_NOTIFICATIONS, active=True) @ddt.unpack diff --git a/openedx/core/djangoapps/notifications/views.py b/openedx/core/djangoapps/notifications/views.py index b5a120e305..da969cc507 100644 --- a/openedx/core/djangoapps/notifications/views.py +++ b/openedx/core/djangoapps/notifications/views.py @@ -332,7 +332,7 @@ class NotificationCountView(APIView): # Get the unseen notifications count for each app name. count_by_app_name = ( Notification.objects - .filter(user_id=request.user, last_seen__isnull=True) + .filter(user_id=request.user, last_seen__isnull=True, web=True) .values('app_name') .annotate(count=Count('*')) )