Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix reviews remarks

fowczarekf31f3a819009
diff --git a/saleor/discount/models.py b/saleor/discount/models.py
index a7a6a03538..8b084c027b 100644
--- a/saleor/discount/models.py
+++ b/saleor/discount/models.py
@@ -33,9 +33,7 @@ class NotApplicable(ValueError):
class VoucherQueryset(models.QuerySet):
def active(self, date):
return self.filter(
- Q(usage_limit__isnull=True)
- | Q(used__lt=F("usage_limit"))
- | Q(usage_limit=0),
+ Q(usage_limit__isnull=True) | Q(used__lt=F("usage_limit")),
Q(end_date__isnull=True) | Q(end_date__gte=date),
start_date__lte=date,
)
diff --git a/tests/test_discounts.py b/tests/test_discounts.py
index e570307c33..94f5106169 100644
--- a/tests/test_discounts.py
+++ b/tests/test_discounts.py
@@ -84,13 +84,6 @@ def test_voucher_queryset_active(voucher):
assert active_vouchers.count() == 0
-def test_voucher_queryset_active_usage_limit_zero(voucher):
- voucher.usage_limit = 0
- voucher.save()
- active_vouchers = Voucher.objects.active(date=timezone.now())
- assert active_vouchers.count() == 1
-
-
@pytest.mark.parametrize(
"prices, discount_value, discount_type, apply_once_per_order, expected_value",
[