summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-11-20 11:33:39 +0100
committerMarius Peter <dev@marius-peter.com>2025-11-20 11:33:39 +0100
commitc0c81afb346254893457c33e3a9eb9081d13332a (patch)
tree759b5b1f8dd4a101062b8e678f100f91eb4eea21
parent09ba1e517c12561e25c9c36796029004eaa3f578 (diff)
Add crop-id guard.
-rw-r--r--models/crop-requirement.rkt7
1 files changed, 4 insertions, 3 deletions
diff --git a/models/crop-requirement.rkt b/models/crop-requirement.rkt
index 6ddf1aa..2048091 100644
--- a/models/crop-requirement.rkt
+++ b/models/crop-requirement.rkt
@@ -28,9 +28,10 @@
"nutrient.rkt"
"crop.rkt")
-;; Instances of this struct are persisted in the crop_requirements table.
-(struct crop-requirement (id profile crop-id) #:transparent)
-
+(struct crop-requirement (id profile crop-id nutrient-values)
+ #:transparent
+ #:guard (λ (id profile crop-id nutrient-values _)
+ (values id profile (if (sql-null? crop-id) #f crop-id) nutrient-values)))
;; CREATE
Copyright 2019--2026 Marius PETER