Restrict Price
assignment to unit price with "lb" only
This commit is contained in:
@@ -117,7 +117,7 @@ func (c Config) GetItemPrice(ctx context.Context, b extractor.Browser, u *url.UR
|
|||||||
if len(units) > 1 {
|
if len(units) > 1 {
|
||||||
res.Unit = strings.TrimSpace(units[1])
|
res.Unit = strings.TrimSpace(units[1])
|
||||||
res.UnitPrice, _ = strconv.ParseFloat(units[0], 64)
|
res.UnitPrice, _ = strconv.ParseFloat(units[0], 64)
|
||||||
if res.UnitPrice != 0 {
|
if res.UnitPrice != 0 && res.Unit == "lb" {
|
||||||
res.Price = res.UnitPrice
|
res.Price = res.UnitPrice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user