diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-12-03 21:17:13 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-12-03 21:17:13 +0100 |
| commit | a26fa8aa89c09b49284cbb5d674399d659f98c1b (patch) | |
| tree | 7eac81a7ff4b8742698e9880746e2cc90b2db762 /views.rkt | |
| parent | cafc59e5930997934fbbb6b5f6e8024ed33fc1f9 (diff) | |
Fertilizers should not report nutrients which they don't contain...
Diffstat (limited to 'views.rkt')
| -rw-r--r-- | views.rkt | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -245,13 +245,14 @@ (define (show-fertilizer-page fp) (define title (fertilizer-product-name fp)) + (define nutrient-values (fertilizer-product-values fp)) (define table `(table ((class "table")) (thead (tr (th "Nutriment") (th ((class "text-end")) "Apport (mg/L)"))) - (tbody ,@(for/list ([n (get-nutrients)]) - (define nutrient-value (hash-ref (fertilizer-product-values fp) n 0)) - `(tr (td ,(nutrient-french-name n)) - (td ((class "text-end font-monospace")) ,(round 2 nutrient-value))))))) + (tbody ,@(for/list ([(nutrient quantity) (in-hash nutrient-values)] + #:when (not (zero? quantity))) + `(tr (td ,(nutrient-french-name nutrient)) + (td ((class "text-end font-monospace")) ,(round 2 quantity))))))) (page-template title `((h1 ((class "display-1 mb-3")) ,title) |