diff options
Diffstat (limited to 'guix-data-service/web/compare')
-rw-r--r-- | guix-data-service/web/compare/controller.scm | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/guix-data-service/web/compare/controller.scm b/guix-data-service/web/compare/controller.scm index a847a1b..a6aa198 100644 --- a/guix-data-service/web/compare/controller.scm +++ b/guix-data-service/web/compare/controller.scm @@ -57,30 +57,33 @@ (parallel-via-thread-pool-channel (with-thread-postgresql-connection (lambda (conn) - (if (guix-commit-exists? conn s) - s - (let* ((job-details - (select-job-for-commit conn s)) - (job-state - (assq-ref job-details 'state))) - (if job-details - (make-invalid-query-parameter - s - (cond - ((string=? job-state "queued") - `("data unavailable, " - (a (@ (href ,(string-append - "/revision/" s))) - "yet to process revision"))) - ((string=? job-state "failed") - `("data unavailable, " - (a (@ (href ,(string-append - "/revision/" s))) - "failed to process revision"))) - (else - "unknown job state"))) - (make-invalid-query-parameter - s "unknown commit")))))))) + (let* ((job-details + (select-job-for-commit conn s)) + (job-state + (assq-ref job-details 'state))) + (if job-details + (cond + ((string=? job-state "succeeded") + s) + ((string=? job-state "queued") + (make-invalid-query-parameter + s + `("data unavailable, " + (a (@ (href ,(string-append + "/revision/" s))) + "yet to process revision")))) + ((string=? job-state "failed") + (make-invalid-query-parameter + s + `("data unavailable, " + (a (@ (href ,(string-append + "/revision/" s))) + "failed to process revision")))) + (else + (make-invalid-query-parameter + s "unknown job state"))) + (make-invalid-query-parameter + s "unknown commit"))))))) (define (parse-derivation file-name) (if (parallel-via-thread-pool-channel |