[Racket] Ferti hydroponic nutrient solver, redux.
Permit empty strings for the brand name.
This allows the canonical-name/brand-name database uniqueness constraint.
models/fertilizer-product.rkt
@@ -28,10 +28,7 @@
28
28
(struct fertilizer-product (id canonical-name brand-name nutrient-values)
29
29
#:transparent
30
30
#:guard (λ (id canonical-name brand-name nutrient-values _)
31
Removed:
(values id
32
Removed:
canonical-name
33
Removed:
(if (or (sql-null? brand-name) (= (string-length brand-name) 0)) #f brand-name)
34
Removed:
nutrient-values))
31
Added:
(values id canonical-name (if (sql-null? brand-name) #f brand-name) nutrient-values))
35
32
#:property prop:custom-write
36
33
(λ (v out _mode)
37
34
(fprintf out "Fertilizer #~a\n" (fertilizer-product-id v))