[Racket] Ferti hydroponic nutrient solver, redux.
Avoid displaying recipe table if recipe does not exist.
views.rkt
@@ -116,14 +116,16 @@
116
116
;;;;;;;;
117
117
118
118
(h2 () "Recette")
119
Removed:
(table ([class "table"])
120
Removed:
(tr (th () "Produit Fertilisant")
121
Removed:
(th ([class "text-end"]) "Quantité"))
122
Removed:
,@(for/list ([fertilizer-amount ferti-recipe]
123
Removed:
#:when (not (zero? (cdr fertilizer-amount))))
124
Removed:
(match-define (cons fertilizer amount) fertilizer-amount)
125
Removed:
`(tr (td () ,(fertilizer-name fertilizer))
126
Removed:
(td ([class "text-end font-monospace"]) ,(round 2 amount)))))
119
Added:
,(if (ormap (λ (pair) (not (zero? (cdr pair)))) ferti-recipe)
120
Added:
`(table ([class "table"])
121
Added:
(tr (th "Intrant")
122
Added:
(th ([class "text-end"]) "Quantité (g/L)"))
123
Added:
,@(for/list ([fertilizer-amount ferti-recipe]
124
Added:
#:when (not (zero? (cdr fertilizer-amount))))
125
Added:
(match-define (cons fertilizer amount) fertilizer-amount)
126
Added:
`(tr (td () ,(fertilizer-name fertilizer))
127
Added:
(td ([class "text-end font-monospace"]) ,(round 2 amount)))))
128
Added:
`(p "La recette Ferti requiert au moins un relevé et une cible."))
127
129
128
130
129
131
;;;;;;;;;