From c0c81afb346254893457c33e3a9eb9081d13332a Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Thu, 20 Nov 2025 11:33:39 +0100 Subject: Add crop-id guard. --- models/crop-requirement.rkt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'models') 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 -- cgit v1.2.3