summaryrefslogtreecommitdiff
path: root/bin/serve.fnl
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-03-14 23:08:43 +0600
committerunwox <me@unwox.com>2025-03-14 23:11:15 +0600
commitec1581999bb370f116fc64aec092fea35ccbbb04 (patch)
tree9905c1bcefe4a4c1430d35a6f2e8922a7ff417ae /bin/serve.fnl
parent3e9baeff59bdb9da78f41276f01a1fb9a52e0193 (diff)
order products by creation time
Diffstat (limited to 'bin/serve.fnl')
-rw-r--r--bin/serve.fnl8
1 files changed, 5 insertions, 3 deletions
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))