Skip to content

Commit f8e839f

Browse files
committed
ranges start at 1
1 parent 1eac3c9 commit f8e839f

File tree

1 file changed

+5
-5
lines changed
  • airbyte-integrations/connectors/source-faker/source_faker

1 file changed

+5
-5
lines changed

airbyte-integrations/connectors/source-faker/source_faker/source.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,17 @@ def generate_purchases(fake: Faker, user: any, purchases_count: int) -> list[Dic
201201
purchases: list[Dict] = []
202202
purchase_percent_remaining = 80 # ~ 20% of people will have no purchases
203203
total_products = len(generate_products())
204-
purchase_percent_remaining = purchase_percent_remaining - random.randrange(0, 100)
204+
purchase_percent_remaining = purchase_percent_remaining - random.randrange(1, 100)
205205
i = 0
206206
while purchase_percent_remaining > 0:
207207
id = purchases_count + i + 1
208-
product_id = random.randrange(0, total_products)
208+
product_id = random.randrange(1, total_products)
209209
added_to_cart_at = random_date_in_range(user["created_at"])
210210
purchased_at = (
211-
random_date_in_range(added_to_cart_at) if added_to_cart_at is not None and random.randrange(0, 100) <= 70 else None
211+
random_date_in_range(added_to_cart_at) if added_to_cart_at is not None and random.randrange(1, 100) <= 70 else None
212212
) # 70% likely to purchase the item in the cart
213213
returned_at = (
214-
random_date_in_range(purchased_at) if purchased_at is not None and random.randrange(0, 100) <= 30 else None
214+
random_date_in_range(purchased_at) if purchased_at is not None and random.randrange(1, 100) <= 30 else None
215215
) # 10% likely to return the item
216216
purchase = {
217217
"id": id,
@@ -223,7 +223,7 @@ def generate_purchases(fake: Faker, user: any, purchases_count: int) -> list[Dic
223223
}
224224
purchases.append(purchase)
225225

226-
purchase_percent_remaining = purchase_percent_remaining - random.randrange(0, 100)
226+
purchase_percent_remaining = purchase_percent_remaining - random.randrange(1, 100)
227227
i = i + 1
228228
return purchases
229229

0 commit comments

Comments
 (0)