Compare commits

...
2 Commits
Author SHA1 Message Date
TPV 2ede6c77c7 Merge pull request 'use .get for has_msrp' (#9) from development into main
Reviewed-on: #9
2026-08-04 18:49:45 +00:00
TPV 6c309b1e62 use .get for has_msrp 2026-08-04 11:49:19 -07:00
+6 -2
View File
@@ -169,7 +169,11 @@ def build_product_details(
original_price = product["originalPrice"]
percentage = 0
has_msrp = product["hasMsrp"]
# Defaulted, not indexed: documents written before the field existed have no
# hasMsrp at all, and stale ones that drop out of a monitor's feed are never
# re-upserted, so they would KeyError here forever. True keeps them on the
# pre-existing threshold path rather than silently routing them as MSRP-less.
has_msrp = product.get("hasMsrp", True)
if has_msrp:
if not original_price:
LOGGER.warning(
@@ -218,7 +222,7 @@ def build_product_details(
original_price=original_price,
price_before_drop=product["priceBeforeDrop"],
edu_price=product["eduPrice"],
past_prices=product["pastPrices"],
past_prices=product.get("pastPrices"),
has_msrp=has_msrp,
),
availability=AvailabilityInfo(