diff options
| author | horus | 2018-02-12 23:46:59 +0100 |
|---|---|---|
| committer | horus | 2018-02-12 23:46:59 +0100 |
| commit | c9e1e5522cfaa9a9fc4a7074902ddadbcef26c52 (patch) | |
| tree | b1da2dc08105978d32d542e95050d73ec9514d60 /crawler/database.go | |
| parent | e39be64451a09dd18e7b1996d95d90eb077487ab (diff) | |
| download | alkobote-c9e1e5522cfaa9a9fc4a7074902ddadbcef26c52.tar.gz | |
Bugfix. (crawler)
Diffstat (limited to 'crawler/database.go')
| -rw-r--r-- | crawler/database.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crawler/database.go b/crawler/database.go index a94e2f0..4245c4e 100644 --- a/crawler/database.go +++ b/crawler/database.go @@ -48,12 +48,12 @@ func (app *App) createTables() error { for _, v := range views { var spirit_type string - if v == "misc" { - spirit_type = `spirit_type = "` + v + `"` + if v != "misc" { + spirit_type = `spirit_type = "` + v + `" AND` } else if v == "all" { spirit_type = "" } else { - spirit_type = `spirit_type NOT IN ("` + strings.Join(views, `", "`) + `")` + spirit_type = `spirit_type NOT IN ("` + strings.Join(views, `", "`) + `") AND` } view_query := `CREATE OR REPLACE VIEW ` + v + `_view AS @@ -62,8 +62,8 @@ func (app *App) createTables() error { shop.name as shop, shop.url as shop_url, shop.shipping_costs/100 as shipping_costs, shop.free_shipping, ROUND(100-((discounted_price/original_price)*100)) AS procent, spirit_type, created_at FROM angebot JOIN shop ON angebot.shop = shop.id - WHERE 1 = 1 - ` + spirit_type + ` AND (valid_until IS NULL OR valid_until > (SELECT UNIX_TIMESTAMP()))` + WHERE + ` + spirit_type + ` (valid_until IS NULL OR valid_until > (SELECT UNIX_TIMESTAMP()))` _, err = app.DB.Exec(view_query) if err != nil { return err |
