database: Fix search pagination.
* src/cuirass/database.scm (db-get-builds-by-search): Fix pagination.
This commit is contained in:
parent
e61e7a5ca4
commit
dea5707750
|
@ -843,7 +843,9 @@ WHERE build = " build-id))
|
||||||
FILTERS is an assoc list whose possible keys are the symbols query,
|
FILTERS is an assoc list whose possible keys are the symbols query,
|
||||||
border-low-id, border-high-id, and nr."
|
border-low-id, border-high-id, and nr."
|
||||||
(with-db-worker-thread db
|
(with-db-worker-thread db
|
||||||
(let* ((query (format #f "SELECT Builds.id, Builds.timestamp,
|
(let* ((query (format #f "
|
||||||
|
SELECT * FROM
|
||||||
|
(SELECT Builds.id, Builds.timestamp,
|
||||||
Builds.starttime,Builds.stoptime, Builds.log, Builds.status,
|
Builds.starttime,Builds.stoptime, Builds.log, Builds.status,
|
||||||
Builds.job_name, Builds.system, Builds.nix_name, Specifications.name
|
Builds.job_name, Builds.system, Builds.nix_name, Specifications.name
|
||||||
FROM Builds
|
FROM Builds
|
||||||
|
@ -856,10 +858,10 @@ AND ((Builds.system = :system) OR :system IS NULL)
|
||||||
AND ((:borderlowid < Builds.id) OR :borderlowid IS NULL)
|
AND ((:borderlowid < Builds.id) OR :borderlowid IS NULL)
|
||||||
AND ((:borderhighid > Builds.id) OR :borderhighid IS NULL)
|
AND ((:borderhighid > Builds.id) OR :borderhighid IS NULL)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
CASE WHEN :borderlowid IS NULL THEN Builds.id
|
(CASE WHEN :borderlowid IS NULL THEN Builds.id
|
||||||
ELSE -Builds.id
|
ELSE -Builds.id END) DESC
|
||||||
END DESC
|
LIMIT :nr) Builds
|
||||||
LIMIT :nr;"))
|
ORDER BY Builds.id DESC;"))
|
||||||
(builds
|
(builds
|
||||||
(exec-query/bind-params
|
(exec-query/bind-params
|
||||||
db
|
db
|
||||||
|
@ -873,7 +875,7 @@ LIMIT :nr;"))
|
||||||
(let loop ((builds builds)
|
(let loop ((builds builds)
|
||||||
(result '()))
|
(result '()))
|
||||||
(match builds
|
(match builds
|
||||||
(() result)
|
(() (reverse result))
|
||||||
(((id timestamp starttime stoptime log status job-name
|
(((id timestamp starttime stoptime log status job-name
|
||||||
system nix-name specification)
|
system nix-name specification)
|
||||||
. rest)
|
. rest)
|
||||||
|
|
Loading…
Reference in New Issue