From 9f94e3278eb0b9df82d0035e19476498ad2c3484 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 19 May 2019 21:26:14 +0100 Subject: Improve the query-parameters module for checkbox support --- guix-data-service/web/query-parameters.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guix-data-service/web/query-parameters.scm b/guix-data-service/web/query-parameters.scm index dbf2e65..41e9beb 100644 --- a/guix-data-service/web/query-parameters.scm +++ b/guix-data-service/web/query-parameters.scm @@ -40,6 +40,7 @@ query-parameters->string parse-datetime + parse-checkbox-value parse-result-limit)) (define (parse-query-string query) @@ -161,6 +162,7 @@ (define (value->text value) (match value (#f "") + (#t "on") ((? date? date) (date->string date "~1 ~3")) (other other))) @@ -191,6 +193,9 @@ (lambda (key . args) (make-invalid-query-parameter s #f)))) +(define (parse-checkbox-value s) + (string=? s "on")) + (define (parse-result-limit s) (match (string->number s) (#f (make-invalid-query-parameter s #f)) -- cgit v1.2.3