From 87dd4f44ff0f5cb934c1cfde81d4dd25401a877d Mon Sep 17 00:00:00 2001 From: Maximilian Möhring Date: Fri, 22 Jan 2021 11:29:35 +0100 Subject: Bugfix. Calculates base_price correctly. --- crawler/shop_drankdozijn.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crawler/shop_drankdozijn.go b/crawler/shop_drankdozijn.go index 8cf18ba..ed82792 100644 --- a/crawler/shop_drankdozijn.go +++ b/crawler/shop_drankdozijn.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "math" "net/http" //"strings" @@ -187,13 +188,6 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { panic(err) } - W.Base_price, err = convert_price(d12_product.FormatedPrice) - if err != nil { - // TODO - log.Println("converting price from product_details failed") - panic(err) - } - for _, v := range d12_product.Features { if v.Description == "Alkoholgehalt" { W.Abv, err = extract_abv(v.Value.Description) @@ -280,6 +274,8 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { } } + W.Base_price = int(math.Round(float64(W.Discounted_price) / float64(W.Volume))) + //W.Debug("DEBUG OFFER") if W.Abv == 0 { W.Println("Drankdozijn: Abv is zero") -- cgit v1.2.3