From 82fce5a200bbcd0b49b97b499b8eb7d765e65a83 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Mon, 20 Oct 2025 22:36:20 -0400 Subject: [PATCH] Handle unit suffix in price parsing and add logging Refined price parsing logic to strip trailing periods from units (e.g., "lb." -> "lb") for better handling. Added logging for debugging extracted response data. --- sites/wegmans/wegmans.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sites/wegmans/wegmans.go b/sites/wegmans/wegmans.go index 0c9180f..e70c63b 100644 --- a/sites/wegmans/wegmans.go +++ b/sites/wegmans/wegmans.go @@ -117,11 +117,15 @@ func (c Config) GetItemPrice(ctx context.Context, b extractor.Browser, u *url.UR if len(units) > 1 { res.Unit = strings.TrimSpace(units[1]) res.UnitPrice, _ = strconv.ParseFloat(units[0], 64) - if res.UnitPrice != 0 && res.Unit == "lb" { - res.Price = res.UnitPrice + + // the unit might be like "lb.", so if it ends in a period, then just strip it off + if strings.HasSuffix(res.Unit, ".") { + res.Unit = strings.TrimSuffix(res.Unit, ".") } } } + slog.Info("res", "res", res) + return res, nil }