PRICING
This commit is contained in:
@@ -8,10 +8,10 @@ class InventoryItemContext:
|
||||
def __init__(self, item: InventoryItem, db: Session):
|
||||
self.item = item
|
||||
self.physical_item = item.physical_item
|
||||
self.marketplace_listings = item.marketplace_listings
|
||||
self.marketplace_listing = item.marketplace_listing
|
||||
self.parent = item.parent
|
||||
self.children = item.children
|
||||
self.product = item.product
|
||||
self.product = item.products
|
||||
self.db = db
|
||||
|
||||
@property
|
||||
@@ -44,9 +44,9 @@ class InventoryItemContext:
|
||||
|
||||
@property
|
||||
def listed_price(self) -> float:
|
||||
if not self.marketplace_listings:
|
||||
if not self.marketplace_listing:
|
||||
return 0.0
|
||||
return self.marketplace_listings[0].listed_price if self.marketplace_listings else 0.0
|
||||
return self.marketplace_listing[0].listed_price if self.marketplace_listing else 0.0
|
||||
|
||||
def top_level_parent(self) -> "InventoryItemContext":
|
||||
if self.parent:
|
||||
@@ -71,9 +71,9 @@ class InventoryItemContext:
|
||||
raise ValueError("Cannot find transaction unit price for this item")
|
||||
|
||||
def age_on_marketplace(self) -> int:
|
||||
if not self.marketplace_listings:
|
||||
if not self.marketplace_listing:
|
||||
return 0
|
||||
return (datetime.now() - self.marketplace_listings[0].listing_date).days
|
||||
return (datetime.now() - self.marketplace_listing[0].listing_date).days
|
||||
|
||||
|
||||
class InventoryItemContextFactory:
|
||||
|
Reference in New Issue
Block a user