summaryrefslogtreecommitdiff
path: root/bin/fetch.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/fetch.fnl')
-rw-r--r--bin/fetch.fnl8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/fetch.fnl b/bin/fetch.fnl
index 0551d76..a5f8d63 100644
--- a/bin/fetch.fnl
+++ b/bin/fetch.fnl
@@ -33,6 +33,7 @@
image TEXT NOT NULL,
price REAL NOT NULL,
weight REAL NOT NULL,
+ volume REAL NOT NULL,
price_per REAL NOT NULL,
archived BOOL NOT NULL,
creation_time DATETIME NOT NULL
@@ -102,7 +103,7 @@
(local sql
(.. "INSERT OR REPLACE INTO products VALUES "
(array.join
- (map (fn [_ _] "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
+ (map (fn [_ _] "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
products)
", ")))
(local creation-time (now))
@@ -118,6 +119,7 @@
(or product.image "")
(or product.price 0)
(or product.weight 0)
+ (or product.volume 0)
(or product.price-per 0)
(or product.archived false)
creation-time]))
@@ -152,8 +154,8 @@
;; replace with with-tx
(local tx (must (luna.db.begin db)))
(must (luna.db.exec-tx tx "DELETE FROM product_tags;" []))
-(each [_ parser (pairs [ozchai gorkovchay chaekshop clubcha artoftea ipuer
- moychay])]
+(each [_ parser (pairs [ozchai clubcha ipuer artoftea chaekshop moychay
+ gorkovchay])]
(store-products tx (parser.products)))
(cache.clear-tx tx "page:")
(must (luna.db.commit tx))