Skip to content

Commit

Permalink
Purchase info can change, so do not depend on it being 3 items (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
viggo-devries authored Oct 21, 2024
1 parent 17f9b78 commit 699687a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions oscar_odin/mappings/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ def map_stock_price(self) -> Tuple[Decimal, str, int, bool]:
stock_strategy: DefaultStrategy = self.context["stock_strategy"]

if self.source.is_parent:
price, availability, _ = stock_strategy.fetch_for_parent(self.source)
price_info = stock_strategy.fetch_for_parent(self.source)
else:
price, availability, _ = stock_strategy.fetch_for_product(self.source)
price_info = stock_strategy.fetch_for_product(self.source)
return (
getattr(price, "excl_tax", Decimal(0)),
getattr(price, "currency", ""),
getattr(availability, "num_available", 0),
availability.is_available_to_buy,
getattr(price_info.price, "excl_tax", Decimal(0)),
getattr(price_info.price, "currency", ""),
getattr(price_info.availability, "num_available", 0),
price_info.availability.is_available_to_buy,
)


Expand Down

0 comments on commit 699687a

Please sign in to comment.