fix(filters): refine filter logic in TopupFilter to ensure only unpaid topups are considered for expiration check 🐛
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m45s

This commit is contained in:
2025-07-05 20:14:58 +05:00
parent 27f89b6d3d
commit 193ce850b4

View File

@ -43,9 +43,10 @@ class TopupFilter(django_filters.FilterSet):
Filter topups based on whether they are expired or not
"""
now = timezone.now()
if value: # Filter for expired topups
queryset = queryset.filter(paid=False)
if value:
return queryset.filter(expires_at__isnull=False, expires_at__lt=now)
else: # Filter for non-expired topups
else:
return queryset.filter(Q(expires_at__isnull=True) | Q(expires_at__gte=now))
class Meta: