From a484fcba7682baad0212fa256a8daabd9fb4e623 Mon Sep 17 00:00:00 2001 From: unwox Date: Mon, 3 Feb 2025 18:02:43 +0600 Subject: fix suhexuan fetching out of stock products --- parser/suhexuan.fnl | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'parser/suhexuan.fnl') diff --git a/parser/suhexuan.fnl b/parser/suhexuan.fnl index 8592294..4eeee53 100644 --- a/parser/suhexuan.fnl +++ b/parser/suhexuan.fnl @@ -25,22 +25,23 @@ (local weight (parser.guess-weight product.title ["г"])) (local price (number.string->number product.price)) - {:site "suhexuan" - :url product.url - :title product.title - :description product.text - ;; FIXME: parse all editions into different products - :image (if (< 0 (# gallery)) - (. gallery 1 :img) - "") - :weight weight - :volume (or (parser.guess-volume product.text) - (parser.guess-volume product.title)) - :price price - :price-per (if (and price weight (< 0 weight)) - (/ (math.ceil (* (/ price weight) 10)) 10) - nil) - :characteristics product.characteristics}) + (when (~= product.quantity "0") + {:site "suhexuan" + :url product.url + :title product.title + :description product.text + ;; FIXME: parse all editions into different products + :image (if (< 0 (# gallery)) + (. gallery 1 :img) + "") + :weight weight + :volume (or (parser.guess-volume product.text) + (parser.guess-volume product.title)) + :price price + :price-per (if (and price weight (< 0 weight)) + (/ (math.ceil (* (/ price weight) 10)) 10) + nil) + :characteristics product.characteristics})) (fn products [] (fetcher.from-json -- cgit v1.2.3