diff options
| -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) |