From 943df5068bce632767d28a6a4fbd145dbec27f2b Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Thu, 19 Mar 2026 16:24:49 +0500 Subject: [PATCH 1/2] updated quota logic to not delete public data and starting kit when deleteing unused datasets and programs from quota interface --- src/apps/api/views/quota.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/apps/api/views/quota.py b/src/apps/api/views/quota.py index 0b99ff3a2..3506d19ff 100644 --- a/src/apps/api/views/quota.py +++ b/src/apps/api/views/quota.py @@ -18,10 +18,13 @@ def user_quota_cleanup(request): ).count() # Get Unused datasets and programs count + # Exclude Submission, Competition Bundle, Public Data, Starting Kit unused_datasets_programs = Data.objects.filter( Q(created_by=request.user) & ~Q(type=Data.SUBMISSION) & - ~Q(type=Data.COMPETITION_BUNDLE) + ~Q(type=Data.COMPETITION_BUNDLE) & + ~Q(type=Data.PUBLIC_DATA) & + ~Q(type=Data.STARTING_KIT) ).exclude( Q(task_ingestion_programs__isnull=False) | Q(task_input_datas__isnull=False) | @@ -81,10 +84,13 @@ def delete_unused_tasks(request): @api_view(['DELETE']) def delete_unused_datasets(request): try: + # Exclude Submission, Competition Bundle, Public Data, Starting Kit Data.objects.filter( Q(created_by=request.user) & ~Q(type=Data.SUBMISSION) & - ~Q(type=Data.COMPETITION_BUNDLE) + ~Q(type=Data.COMPETITION_BUNDLE) & + ~Q(type=Data.PUBLIC_DATA) & + ~Q(type=Data.STARTING_KIT) ).exclude( Q(task_ingestion_programs__isnull=False) | Q(task_input_datas__isnull=False) | From 9d295aaa651cc899dd9f7060bf61aa6dcb2332d2 Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Thu, 19 Mar 2026 16:36:15 +0500 Subject: [PATCH 2/2] tests updated --- src/apps/api/tests/test_cleanup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/apps/api/tests/test_cleanup.py b/src/apps/api/tests/test_cleanup.py index a927800af..80d78d8c3 100644 --- a/src/apps/api/tests/test_cleanup.py +++ b/src/apps/api/tests/test_cleanup.py @@ -56,8 +56,7 @@ def setUp(self): DataFactory(created_by=user, type=Data.INGESTION_PROGRAM), DataFactory(created_by=user, type=Data.SCORING_PROGRAM), DataFactory(created_by=user, type=Data.INPUT_DATA), - DataFactory(created_by=user, type=Data.REFERENCE_DATA), - DataFactory(created_by=user, type=Data.PUBLIC_DATA) + DataFactory(created_by=user, type=Data.REFERENCE_DATA) ] self.client.login(username='test_user', password='test_user')