Skip to content

Commit

Permalink
Update instance filter query to AND operation
Browse files Browse the repository at this point in the history
Signed-off-by: Kipchirchir Sigei <[email protected]>
  • Loading branch information
KipSigei committed Jul 3, 2023
1 parent a709f15 commit d172194
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions onadata/apps/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from django.core.files.uploadedfile import TemporaryUploadedFile
from django.core.files.storage import default_storage
from django.contrib.auth import get_user_model
from django.db.models import Q
from django.utils import timezone
from django.utils.datastructures import MultiValueDict

Expand Down Expand Up @@ -123,7 +122,7 @@ def delete_inactive_submissions():
time_threshold = timezone.now() - timedelta(days=submissions_lifespan)
# delete instance attachments
instances = Instance.objects.filter(
Q(deleted_at__isnull=False) | Q(deleted_at__gte=time_threshold)
deleted_at__isnull=False, deleted_at__gte=time_threshold
)
for instance in queryset_iterator(instances):
# delete submission
Expand Down

0 comments on commit d172194

Please sign in to comment.