diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-17 12:15:15 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-17 12:15:15 +0100 |
| commit | 78287b13a960e7a5462416813a3ab333ded57c82 (patch) | |
| tree | 4df26bacb222fc6871c1aa6d2889e7f1d624d963 | |
| parent | b68c743ce0e9b9f3cd71a1b416d7794601ae5b48 (diff) | |
Avoid displaying recipe table if recipe does not exist.
| -rw-r--r-- | views.rkt | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -116,14 +116,16 @@ ;;;;;;;; (h2 () "Recette") - (table ([class "table"]) - (tr (th () "Produit Fertilisant") - (th ([class "text-end"]) "Quantité")) - ,@(for/list ([fertilizer-amount ferti-recipe] - #:when (not (zero? (cdr fertilizer-amount)))) - (match-define (cons fertilizer amount) fertilizer-amount) - `(tr (td () ,(fertilizer-name fertilizer)) - (td ([class "text-end font-monospace"]) ,(round 2 amount))))) + ,(if (ormap (λ (pair) (not (zero? (cdr pair)))) ferti-recipe) + `(table ([class "table"]) + (tr (th "Intrant") + (th ([class "text-end"]) "Quantité (g/L)")) + ,@(for/list ([fertilizer-amount ferti-recipe] + #:when (not (zero? (cdr fertilizer-amount)))) + (match-define (cons fertilizer amount) fertilizer-amount) + `(tr (td () ,(fertilizer-name fertilizer)) + (td ([class "text-end font-monospace"]) ,(round 2 amount))))) + `(p "La recette Ferti requiert au moins un relevé et une cible.")) ;;;;;;;;; |