From 155c9c5bbb703490e5d61f7b4504987e35088a95 Mon Sep 17 00:00:00 2001 From: unwox Date: Wed, 11 Dec 2024 20:41:29 +0600 Subject: integrate moychay.ru tea shop --- bin/fetch.fnl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'bin/fetch.fnl') diff --git a/bin/fetch.fnl b/bin/fetch.fnl index a3155a4..006cbea 100644 --- a/bin/fetch.fnl +++ b/bin/fetch.fnl @@ -6,6 +6,7 @@ (local array (require :lib.array)) (local cache (require :lib.cache)) +(local moychay (require :parser.moychay)) (local ozchai (require :parser.ozchai)) (local ipuer (require :parser.ipuer)) (local artoftea (require :parser.artoftea)) @@ -101,7 +102,7 @@ (.. "INSERT OR REPLACE INTO products VALUES " (array.join (map (fn [_ _] "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") - products) + products) ", "))) (local creation-time (now)) (local vars @@ -117,7 +118,7 @@ (or product.price 0) (or product.weight 0) (or product.price-per 0) - false + (or product.archived false) creation-time])) products [])) (must (luna.db.exec-tx tx sql vars)) @@ -150,12 +151,8 @@ ;; replace with with-tx (local tx (must (luna.db.begin db))) (must (luna.db.exec-tx tx "DELETE FROM product_tags;" [])) -(each [_ products (pairs [chaekshop.products - clubcha.products - artoftea.products - ipuer.products - ozchai.products])] - (store-products tx (products))) +(each [_ parser (pairs [chaekshop clubcha artoftea ipuer ozchai moychay])] + (store-products tx (parser.products))) (cache.clear-tx tx "page:") (must (luna.db.commit tx)) -- cgit v1.2.3