summaryrefslogtreecommitdiff
path: root/views.rkt
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-11-17 12:15:15 +0100
committerMarius Peter <dev@marius-peter.com>2025-11-17 12:15:15 +0100
commit78287b13a960e7a5462416813a3ab333ded57c82 (patch)
tree4df26bacb222fc6871c1aa6d2889e7f1d624d963 /views.rkt
parentb68c743ce0e9b9f3cd71a1b416d7794601ae5b48 (diff)
Avoid displaying recipe table if recipe does not exist.
Diffstat (limited to 'views.rkt')
-rw-r--r--views.rkt18
1 files 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."))
;;;;;;;;;
Copyright 2019--2026 Marius PETER