aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage/server.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-10-02 19:29:37 +0100
committerChristopher Baines <mail@cbaines.net>2023-10-02 19:29:37 +0100
commit343027d3f50510411b4cacbd08965452652079b1 (patch)
treea92e7b032e5c9d5845c2f8c9de22855ff6583e93 /guix-qa-frontpage/server.scm
parentfe895cdd1c540e4dd119aca542c466b178c36b37 (diff)
downloadqa-frontpage-343027d3f50510411b4cacbd08965452652079b1.tar
qa-frontpage-343027d3f50510411b4cacbd08965452652079b1.tar.gz
Allow filtering issues by status
Diffstat (limited to 'guix-qa-frontpage/server.scm')
-rw-r--r--guix-qa-frontpage/server.scm42
1 files changed, 31 insertions, 11 deletions
diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm
index 9c5564d..1514d7b 100644
--- a/guix-qa-frontpage/server.scm
+++ b/guix-qa-frontpage/server.scm
@@ -216,19 +216,38 @@
'latest-patchwork-series-by-issue
latest-patchwork-series-by-issue
#:ttl 1800))
+ (query-params
+ (or (and=>
+ (uri-query (request-uri request))
+ parse-query-string)
+ '()))
+ (filtered-statuses
+ (filter-map
+ (match-lambda
+ ((key . val)
+ (let ((symbol-key (string->symbol key)))
+ (if (and (member symbol-key %overall-statuses)
+ (string=? val "on"))
+ symbol-key
+ #f))))
+ query-params))
(latest-series-with-overall-statuses
- (map
+ (filter-map
(lambda (series)
- (append series
- `((overall-status
- .
- ,(with-sqlite-cache
- database
- 'issue-patches-overall-status
- (const #f)
- #:store-computed-value? #f
- #:args (list (first series))
- #:ttl 3600)))))
+ (let ((overall-status
+ (with-sqlite-cache
+ database
+ 'issue-patches-overall-status
+ (const 'unknown)
+ #:store-computed-value? #f
+ #:args (list (first series))
+ #:ttl 3600)))
+ (if (or (null? filtered-statuses)
+ (member overall-status
+ filtered-statuses))
+ (append series
+ `((overall-status . ,overall-status)))
+ #f)))
latest-series))
(sorted-latest-series
(sort
@@ -280,6 +299,7 @@
patch-issues-to-show)
(take sorted-latest-series patch-issues-to-show)
sorted-latest-series)
+ filtered-statuses
systems-with-low-substitute-availability))))
(('GET "issue" (? (lambda (s) (string-suffix? ".svg" s)) number.svg))
(let* ((number