diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-01-23 22:54:01 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-01-23 23:39:13 +0100 |
commit | 06b8af00fbf6c0d146411e895da1bc95365d364b (patch) | |
tree | 354864c62e223834aeb51ad8f9d43d7f040976af | |
parent | 6fb711883965fe40be5ee63b2524273da8414578 (diff) | |
download | cuirass-06b8af00fbf6c0d146411e895da1bc95365d364b.tar cuirass-06b8af00fbf6c0d146411e895da1bc95365d364b.tar.gz |
http: /api/latestbuilds only returns finished builds.
* src/cuirass/database.scm (db-get-builds)[format-where-clause]:
Honor (status done) filter.
* src/cuirass/http.scm (url-handler): Always add (status done)
to the filters passed to 'handle-builds-request'.
-rw-r--r-- | src/cuirass/database.scm | 4 | ||||
-rw-r--r-- | src/cuirass/http.scm | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index 918dcdb..869f8cc 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -303,7 +303,7 @@ INNER JOIN Specifications ON Evaluations.specification = Specifications.repo_nam (define (db-get-builds db filters) "Retrieve all builds in database DB which are matched by given FILTERS. FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job | -'system | 'nr | 'order." +'system | 'nr | 'order | 'status." (define (format-where-clause filters) (let ((where-clause @@ -318,6 +318,8 @@ FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job | (format #f "Derivations.job_name='~A'" job)) (('system system) (format #f "Derivations.system='~A'" system)) + (('status 'done) + "Builds.status >= 0") (_ #f))) filters))) (if (> (length where-clause) 0) diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm index 57326c4..87fb7b7 100644 --- a/src/cuirass/http.scm +++ b/src/cuirass/http.scm @@ -149,8 +149,11 @@ ;; 'nr parameter is mandatory to limit query size. (valid-params? (assq-ref params 'nr))) (if valid-params? + ;; Limit results to builds that are "done". (respond-json (object->json-string - (handle-builds-request db params))) + (handle-builds-request db + `((status done) + ,@params)))) (respond-json-with-error 500 "Parameter not defined!")))) (_ (respond (build-response #:code 404) |