in datasets/thelook_ecommerce/pipelines/_images/run_thelook_kub/fake.py [0:0]
def __post_init__(self, order_item=None):
self.id = order_item.inventory_item_id
self.product_id = order_item.product_id
if order_item.is_sold is True:
self.created_at = order_item.created_at - datetime.timedelta(
minutes=random.randrange(86400)
) # in inventory between 0 and 60 days
self.sold_at = (
order_item.created_at
) # sold on the date/time the order_items was logged
if order_item.is_sold is False:
self.created_at = created_at(datetime.datetime(2020, 1, 1))
self.sold_at = None
self.cost = PRODUCT_BY_ID_DICT[self.product_id]["cost"]
self.product_category = PRODUCT_BY_ID_DICT[self.product_id]["category"]
self.product_name = PRODUCT_BY_ID_DICT[self.product_id]["name"]
self.product_brand = PRODUCT_BY_ID_DICT[self.product_id]["brand"]
self.product_retail_price = PRODUCT_BY_ID_DICT[self.product_id]["retail_price"]
self.product_department = PRODUCT_BY_ID_DICT[self.product_id]["department"]
self.product_sku = PRODUCT_BY_ID_DICT[self.product_id]["sku"]
self.product_distribution_center_id = PRODUCT_BY_ID_DICT[self.product_id][
"distribution_center_id"
]