[Racket] Ferti hydroponic nutrient solver, redux.
Update Ferti recipe view.
views.rkt
@@ -83,16 +83,21 @@
83
83
(a ((class "btn btn-outline-primary") [href "/fertilizer/new"]) "Ajouter un intrant")))
84
84
85
85
(define (ferti-recipe ferti-recipe)
86
Removed:
`((h2 () "Recette") ,(if (ormap (λ (pair) (not (zero? (cdr pair)))) ferti-recipe)
87
Removed:
`(table ((class "table"))
88
Removed:
(tr (th "Intrant") (th ((class "text-end")) "Quantité (g/L)"))
89
Removed:
,@(for/list ([fertilizer-amount ferti-recipe]
90
Removed:
#:when (not (zero? (cdr fertilizer-amount))))
91
Removed:
(match-define (cons fertilizer amount) fertilizer-amount)
92
Removed:
`(tr (td () ,(fertilizer-name fertilizer))
93
Removed:
(td ((class "text-end font-monospace"))
94
Removed:
,(round 2 amount)))))
95
Removed:
`(p "La recette Ferti requiert au moins un relevé et une cible."))))
86
Added:
`((h2 () "Recette")
87
Added:
,(if (ormap (λ (pair) (not (zero? (cdr pair)))) ferti-recipe)
88
Added:
`(table ((class "table"))
89
Added:
(tr (th "Intrant") (th ((class "text-end")) "Quantité (g/L)"))
90
Added:
,@(for/list ([fertilizer-amount ferti-recipe]
91
Added:
#:when (not (zero? (cdr fertilizer-amount))))
92
Added:
(match-define (cons fertilizer amount) fertilizer-amount)
93
Added:
`(tr (td ()
94
Added:
,(let ([canonical-name (fertilizer-name fertilizer)]
95
Added:
[brand-name (fertilizer-brand-name fertilizer)])
96
Added:
(if brand-name
97
Added:
(format "~a (~a)" brand-name canonical-name)
98
Added:
canonical-name)))
99
Added:
(td ((class "text-end font-monospace")) ,(round 2 amount)))))
100
Added:
`(p "La recette Ferti requiert au moins un relevé et une cible."))))
96
101
97
102
(define (ferti-targets latest-measurement-hash latest-target-hash)
98
103
`((h2 () "Dernière Cible")