2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00

http: Sort /api/latestbuilds and /api/queue by time.

* src/cuirass/database.scm (db-get-builds)[format-order-clause]: Add
'order' clauses.
* src/cuirass/http.scm (url-handler): Default to (order finish-time) for
/latestbuilds and (order submission-time) for /queue.
This commit is contained in:
Ludovic Courtès 2018-01-25 10:39:18 +01:00
parent c4963deca1
commit a97665672a
2 changed files with 10 additions and 2 deletions

View file

@ -347,6 +347,12 @@ FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job |
"ORDER BY Builds.id ASC")
(('order 'decreasing-build-id)
"ORDER BY Builds.id DESC")
(('order 'finish-time)
"ORDER BY Builds.stoptime DESC")
(('order 'start-time)
"ORDER BY Builds.start DESC")
(('order 'submission-time)
"ORDER BY Builds.timestamp DESC")
(_ #f))
filters)
"ORDER BY Builds.id DESC")) ;default order

View file

@ -159,7 +159,8 @@
(respond-json (object->json-string
(handle-builds-request db
`((status done)
,@params))))
,@params
(order finish-time)))))
(respond-json-with-error 500 "Parameter not defined!"))))
(("api" "queue")
(let* ((params (request-parameters request))
@ -169,7 +170,8 @@
(respond-json (object->json-string
(handle-builds-request db
`((status pending)
,@params))))
,@params
(order submission-time)))))
(respond-json-with-error 500 "Parameter not defined!"))))
(_
(respond (build-response #:code 404)