From e92cc3a074d914a706c618221551520e64e94131 Mon Sep 17 00:00:00 2001 From: Peter Woolery Date: Mon, 18 May 2026 17:22:29 -0700 Subject: [PATCH] scrapers: drop Swiftly products with unparseable price Products missing a parseable sale or regular price would previously yield a GroceryItem with current_price=None. That broke the downstream matcher (ingredient typical_price is non-null) and cluttered the table. Added a guard in map_product() to return None when both reg_price and sale_price are None. Fixes test_map_product_returns_none_for_unparseable. --- backend/app/scraper/lucky_ca_scraper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/app/scraper/lucky_ca_scraper.py b/backend/app/scraper/lucky_ca_scraper.py index efec36a..0c642c0 100644 --- a/backend/app/scraper/lucky_ca_scraper.py +++ b/backend/app/scraper/lucky_ca_scraper.py @@ -259,6 +259,9 @@ class LuckyCaliforniaScraper: promo = price_block.get("promoArea") or {} sale_price, sale_unit = cls._parse_price(promo.get("promoText")) + if reg_price is None and sale_price is None: + return None + unit = sale_unit or reg_unit is_on_sale = sale_price is not None and reg_price is not None and sale_price < reg_price # current_price = "what the customer pays today" → sale_price when on sale.