From ec1581999bb370f116fc64aec092fea35ccbbb04 Mon Sep 17 00:00:00 2001 From: unwox Date: Fri, 14 Mar 2025 23:08:43 +0600 Subject: order products by creation time --- bin/serve.fnl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/serve.fnl') diff --git a/bin/serve.fnl b/bin/serve.fnl index 8793537..b05eaa5 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -210,9 +210,9 @@ (fn latest-update-date [] (. (must (luna.db.query db - "SELECT creation_time + "SELECT update_time FROM products - ORDER BY creation_TIME DESC + ORDER BY update_time DESC LIMIT 1" [])) 1 1)) @@ -309,13 +309,15 @@ FROM search INNER JOIN products ON search.fid = products.url LEFT JOIN product_tags ON product_tags.product = products.url + LEFT JOIN permanent_products ON permanent_products.url = products.url WHERE search.`table` = 'products' AND products.archived = false %s GROUP BY products.url ORDER BY %s ROW_NUMBER() over (PARTITION BY products.site ORDER BY products.ROWID), - rank + rank, + permanent_products.creation_time DESC LIMIT 24 OFFSET ?" where-sql sort-sql) (array.concat query-args [(* (- page 1) 24)]))) :total (if (< 0 (# total)) -- cgit v1.2.3