summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models/nutrient.rkt5
1 files changed, 3 insertions, 2 deletions
diff --git a/models/nutrient.rkt b/models/nutrient.rkt
index 6bbaf56..8d38f74 100644
--- a/models/nutrient.rkt
+++ b/models/nutrient.rkt
@@ -7,7 +7,7 @@
nutrient-id nutrient-name nutrient-formula
;; SQL CRUD
(contract-out
- [create-nutrient! (-> string? string? void?)]
+ [create-nutrient! (-> string? string? nutrient?)]
[get-nutrients (-> (listof nutrient?))]
[get-nutrient (->* ()
(#:id (or/c #f exact-nonnegative-integer?)
@@ -35,7 +35,8 @@
(define (new-nutrient)
(query-exec (current-conn)
(insert #:into nutrients
- #:set [canonical_name ,name] [formula ,formula])))
+ #:set [canonical_name ,name] [formula ,formula]))
+ (get-nutrient #:name name))
(or existing-nutrient
(new-nutrient)))
Copyright 2019--2025 Marius PETER