diff --git a/breathecode/assignments/management/commands/schedule_repository_deletions.py b/breathecode/assignments/management/commands/schedule_repository_deletions.py index f8b86b507..a7fb3215c 100644 --- a/breathecode/assignments/management/commands/schedule_repository_deletions.py +++ b/breathecode/assignments/management/commands/schedule_repository_deletions.py @@ -130,8 +130,8 @@ def purge_deletion_orders(self): page = 0 to_delete = [] while True: - qs = RepositoryDeletionOrder.objects.filter( - status=RepositoryDeletionOrder.Status.PENDING, + qs = RepositoryDeletionOrder.objects.exclude( + status__in=[RepositoryDeletionOrder.Status.TRANSFERRED, RepositoryDeletionOrder.Status.DELETED] )[page * 100 : (page + 1) * 100] if len(qs) == 0: