From 78287b13a960e7a5462416813a3ab333ded57c82 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Mon, 17 Nov 2025 12:15:15 +0100 Subject: Avoid displaying recipe table if recipe does not exist. --- views.rkt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/views.rkt b/views.rkt index d2fd245..172aab3 100644 --- a/views.rkt +++ b/views.rkt @@ -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.")) ;;;;;;;;; -- cgit v1.2.3