diff options
author | Danjela lura <danielaluraa@gmail.com> | 2020-03-29 09:33:31 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-03-29 21:12:35 +0100 |
commit | 6ee9a674cd1762fe3ea90f61b0f915e114c79053 (patch) | |
tree | b753f1641c532c02111882ccfe3ecfddf92688e0 /guix-data-service/web/repository | |
parent | 776d0462e97b5faaf096c4250ae2d3eafb42c072 (diff) | |
download | data-service-6ee9a674cd1762fe3ea90f61b0f915e114c79053.tar data-service-6ee9a674cd1762fe3ea90f61b0f915e114c79053.tar.gz |
Store output of most-recent-commits-for-branch in a local variable
Signed-off-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'guix-data-service/web/repository')
-rw-r--r-- | guix-data-service/web/repository/controller.scm | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/guix-data-service/web/repository/controller.scm b/guix-data-service/web/repository/controller.scm index 6735d10..9837867 100644 --- a/guix-data-service/web/repository/controller.scm +++ b/guix-data-service/web/repository/controller.scm @@ -70,44 +70,38 @@ `((after_date ,parse-datetime) (before_date ,parse-datetime) (limit_results ,parse-result-limit #:default 100))))) - (case (most-appropriate-mime-type - '(application/json text/html) - mime-types) - ((application/json) - (render-json - `((revisions - . ,(list->vector - (map (match-lambda - ((date commit-hash _ _) - `((date . ,date) - (commit-hash . ,commit-hash)))) - (most-recent-commits-for-branch - conn - (string->number repository-id) - branch-name - #:limit (assq-ref parsed-query-parameters 'limit_results) - #:after-date (assq-ref parsed-query-parameters - 'after_date) - #:before-date (assq-ref parsed-query-parameters - 'before_date)))))))) - (else - (render-html - #:sxml (if (any-invalid-query-parameters? parsed-query-parameters) - (view-branch repository-id - branch-name parsed-query-parameters '()) - (view-branch - repository-id - branch-name - parsed-query-parameters - (most-recent-commits-for-branch - conn - (string->number repository-id) - branch-name - #:limit (assq-ref parsed-query-parameters 'limit_results) - #:after-date (assq-ref parsed-query-parameters - 'after_date) - #:before-date (assq-ref parsed-query-parameters - 'before_date))))))))) + (let ((revisions + (most-recent-commits-for-branch + conn + (string->number repository-id) + branch-name + #:limit (assq-ref parsed-query-parameters 'limit_results) + #:after-date (assq-ref parsed-query-parameters + 'after_date) + #:before-date (assq-ref parsed-query-parameters + 'before_date)))) + (case (most-appropriate-mime-type + '(application/json text/html) + mime-types) + ((application/json) + (render-json + `((revisions + . ,(list->vector + (map (match-lambda + ((date commit-hash _ _) + `((date . ,date) + (commit-hash . ,commit-hash)))) + revisions)))))) + (else + (render-html + #:sxml (if (any-invalid-query-parameters? parsed-query-parameters) + (view-branch repository-id + branch-name parsed-query-parameters '()) + (view-branch + repository-id + branch-name + parsed-query-parameters + revisions)))))))) (('GET "repository" repository-id "branch" branch-name "package" package-name) (let ((package-versions (package-versions-for-branch conn |