diff options
| author | unwox <me@unwox.com> | 2025-03-18 14:07:47 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2025-03-18 14:07:47 +0600 |
| commit | 3229f722f653e174f6d9dabd34ea820c02aafa5d (patch) | |
| tree | b7f1d4dfc52f41c1e0c8644dbc826e06a35dfc17 | |
| parent | 36f040cd16d1d974d611ed9e4b98ba74c8c01b42 (diff) | |
fix products ordering by creation_time
| -rw-r--r-- | bin/serve.fnl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl index b05eaa5..799d3ac 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -315,9 +315,11 @@ %s GROUP BY products.url ORDER BY %s - ROW_NUMBER() over (PARTITION BY products.site ORDER BY products.ROWID), - rank, - permanent_products.creation_time DESC + ROW_NUMBER() OVER + (PARTITION BY products.site + ORDER BY permanent_products.creation_time DESC, + products.title ASC), + rank LIMIT 24 OFFSET ?" where-sql sort-sql) (array.concat query-args [(* (- page 1) 24)]))) :total (if (< 0 (# total)) |
