[Racket] Ferti hydroponic nutrient solver, redux.
Simplify function argument combinatorial.
models/crop-requirement.rkt
@@ -90,15 +90,14 @@
90
90
#:group '#(0 1 2)))
91
91
(map grouped-row->crop-requirement grouped-rows))
92
92
93
Removed:
(define (get-crop-requirement #:id [cr-id #f] #:profile [profile #f] #:crop-id [crop-id #f])
93
Added:
(define (get-crop-requirement #:id [cr-id #f] #:profile [profile #f])
94
94
(define where
95
95
(cond
96
Removed:
[(and cr-id profile crop-id)
97
Removed:
(scalar-expr-qq (and (= cr.id ,cr-id) (= cr.profile ,profile) (= cr.crop_id ,crop-id)))]
96
Added:
[(and cr-id profile)
97
Added:
(scalar-expr-qq (and (= cr.id ,cr-id) (= cr.profile ,profile)))]
98
98
[cr-id (scalar-expr-qq (= cr.id ,cr-id))]
99
99
[profile (scalar-expr-qq (= cr.profile ,profile))]
100
Removed:
[crop-id (scalar-expr-qq (= cr.crop_id ,crop-id))]
101
Removed:
[else (error 'get-crop-requirement "one of #:id, #:profile or #:crop-id must be provided")]))
100
Added:
[else (error 'get-crop-requirement "one of #:id or #:profile must be provided")]))
102
101
(define grouped-rows
103
102
(query-rows (current-conn)
104
103
(select cr.id