Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/apps/api/tests/test_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
10 changes: 8 additions & 2 deletions src/apps/api/views/quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -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) |
Expand Down