From e12ec1b1536ebed4d967d2f354523eb02c05e24d Mon Sep 17 00:00:00 2001 From: Muhammad Adeel Tajamul <77053848+muhammadadeeltajamul@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:28:56 +0500 Subject: [PATCH] feat: added group_by_id field in notifications model (#35137) --- cms/envs/common.py | 2 +- lms/envs/common.py | 2 +- .../0006_notification_group_by_id.py | 18 ++++++++++++++++++ .../core/djangoapps/notifications/models.py | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 openedx/core/djangoapps/notifications/migrations/0006_notification_group_by_id.py diff --git a/cms/envs/common.py b/cms/envs/common.py index 895e4c0ed7..be837c5189 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -2688,7 +2688,7 @@ EDXAPP_PARSE_KEYS = {} ############## NOTIFICATIONS EXPIRY ############## NOTIFICATIONS_EXPIRY = 60 EXPIRED_NOTIFICATIONS_DELETE_BATCH_SIZE = 10000 -NOTIFICATION_CREATION_BATCH_SIZE = 83 +NOTIFICATION_CREATION_BATCH_SIZE = 76 ############################ AI_TRANSLATIONS ################################## AI_TRANSLATIONS_API_URL = 'http://localhost:18760/api/v1' diff --git a/lms/envs/common.py b/lms/envs/common.py index 065d059eed..9a56680d4d 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -5382,7 +5382,7 @@ SUBSCRIPTIONS_SERVICE_WORKER_USERNAME = 'subscriptions_worker' ############## NOTIFICATIONS ############## NOTIFICATIONS_EXPIRY = 60 EXPIRED_NOTIFICATIONS_DELETE_BATCH_SIZE = 10000 -NOTIFICATION_CREATION_BATCH_SIZE = 83 +NOTIFICATION_CREATION_BATCH_SIZE = 76 NOTIFICATIONS_DEFAULT_FROM_EMAIL = "no-reply@example.com" NOTIFICATION_TYPE_ICONS = {} DEFAULT_NOTIFICATION_ICON_URL = "" diff --git a/openedx/core/djangoapps/notifications/migrations/0006_notification_group_by_id.py b/openedx/core/djangoapps/notifications/migrations/0006_notification_group_by_id.py new file mode 100644 index 0000000000..5a45b9c25a --- /dev/null +++ b/openedx/core/djangoapps/notifications/migrations/0006_notification_group_by_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.13 on 2024-07-23 07:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('notifications', '0005_notification_email_notification_web'), + ] + + operations = [ + migrations.AddField( + model_name='notification', + name='group_by_id', + field=models.CharField(db_index=True, default='', max_length=42), + ), + ] diff --git a/openedx/core/djangoapps/notifications/models.py b/openedx/core/djangoapps/notifications/models.py index 2f7da1803b..8bf19edce5 100644 --- a/openedx/core/djangoapps/notifications/models.py +++ b/openedx/core/djangoapps/notifications/models.py @@ -109,6 +109,7 @@ class Notification(TimeStampedModel): email = models.BooleanField(default=False, null=False, blank=False) last_read = models.DateTimeField(null=True, blank=True) last_seen = models.DateTimeField(null=True, blank=True) + group_by_id = models.CharField(max_length=42, db_index=True, null=False, default="") def __str__(self): return f'{self.user.username} - {self.course_id} - {self.app_name} - {self.notification_type}'