summaryrefslogtreecommitdiff
path: root/crawler/database.go
diff options
context:
space:
mode:
Diffstat (limited to 'crawler/database.go')
-rw-r--r--crawler/database.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawler/database.go b/crawler/database.go
index 278d891..d0bd632 100644
--- a/crawler/database.go
+++ b/crawler/database.go
@@ -58,7 +58,7 @@ func (app *App) createTables() error {
view_query := `CREATE OR REPLACE VIEW ` + v + `_view AS
SELECT
- angebot.id, angebot.name, angebot.abv, angebot.volume, angebot.url,original_price/100 as original_price, discounted_price/100 as discounted_price, angebot.base_price/100 as base_price, image_url,
+ angebot.id, angebot.name, angebot.abv, angebot.volume, angebot.url as long_url, angebot.short_url as url,original_price/100 as original_price, discounted_price/100 as discounted_price, angebot.base_price/100 as base_price, image_url,
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
@@ -116,7 +116,7 @@ func (app *App) save_offer(W []Angebot) error {
func (app *App) remove_expired(W []Angebot, shop_id int) error {
- query := `SELECT id, shop, name, url, original_price, discounted_price FROM angebot WHERE shop = ? AND created_at < ? AND valid_until IS NULL`
+ query := `SELECT id, shop, name, url, original_price, discounted_price FROM all_view WHERE shop = ? AND created_at < ?`
rows, err := app.DB.Queryx(query, shop_id, app.Now)
if err != nil {