diff options
| author | unwox <me@unwox.com> | 2025-02-03 18:02:43 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-02-03 18:02:43 +0600 |
| commit | a484fcba7682baad0212fa256a8daabd9fb4e623 (patch) | |
| tree | 3579d8f42446cdba39b11c3fdf2e6584fafe0418 | |
| parent | 778ab54f2e97455e07b2247ec9ea79e3a39500e7 (diff) | |
fix suhexuan fetching out of stock products
| -rw-r--r-- | parser/suhexuan.fnl | 33 |
1 files changed, 17 insertions, 16 deletions
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 |
