From 441d7fd5a5a0ccf8d53238d717ec5119024cbbfa Mon Sep 17 00:00:00 2001 From: unwox Date: Thu, 19 Dec 2024 16:03:45 +0600 Subject: parse teaware volume and let users filter by it --- bin/fetch.fnl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/fetch.fnl') 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)) -- cgit v1.2.3