mirror of
https://github.com/Crocmagnon/checkout.git
synced 2024-11-22 08:08:04 +01:00
Sometimes generate dummy baskets without payment method
This commit is contained in:
parent
7f90eb9ec3
commit
5d27164f5d
1 changed files with 3 additions and 3 deletions
|
@ -35,9 +35,9 @@ class Command(BaseCommand):
|
||||||
methods_weights = [random.randint(1, 6) for _ in range(len(payment_methods))]
|
methods_weights = [random.randint(1, 6) for _ in range(len(payment_methods))]
|
||||||
products_weights = [1 / product.display_order for product in products]
|
products_weights = [1 / product.display_order for product in products]
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
method: PaymentMethod = random.choices(
|
method = None
|
||||||
payment_methods, weights=methods_weights
|
if random.random() < 0.99:
|
||||||
)[0]
|
method = random.choices(payment_methods, weights=methods_weights)[0]
|
||||||
basket = Basket.objects.create(payment_method=method)
|
basket = Basket.objects.create(payment_method=method)
|
||||||
items = []
|
items = []
|
||||||
item_count = int(random.normalvariate(3, 2))
|
item_count = int(random.normalvariate(3, 2))
|
||||||
|
|
Loading…
Reference in a new issue