From dd05a730876e668bf522f854963db9632e474244 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Wed, 10 Dec 2025 18:35:37 +0100 Subject: Simplify function argument combinatorial. --- models/crop-requirement.rkt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'models') diff --git a/models/crop-requirement.rkt b/models/crop-requirement.rkt index 96d94cf..018c6c1 100644 --- a/models/crop-requirement.rkt +++ b/models/crop-requirement.rkt @@ -90,15 +90,14 @@ #:group '#(0 1 2))) (map grouped-row->crop-requirement grouped-rows)) -(define (get-crop-requirement #:id [cr-id #f] #:profile [profile #f] #:crop-id [crop-id #f]) +(define (get-crop-requirement #:id [cr-id #f] #:profile [profile #f]) (define where (cond - [(and cr-id profile crop-id) - (scalar-expr-qq (and (= cr.id ,cr-id) (= cr.profile ,profile) (= cr.crop_id ,crop-id)))] + [(and cr-id profile) + (scalar-expr-qq (and (= cr.id ,cr-id) (= cr.profile ,profile)))] [cr-id (scalar-expr-qq (= cr.id ,cr-id))] [profile (scalar-expr-qq (= cr.profile ,profile))] - [crop-id (scalar-expr-qq (= cr.crop_id ,crop-id))] - [else (error 'get-crop-requirement "one of #:id, #:profile or #:crop-id must be provided")])) + [else (error 'get-crop-requirement "one of #:id or #:profile must be provided")])) (define grouped-rows (query-rows (current-conn) (select cr.id -- cgit v1.2.3