summaryrefslogtreecommitdiff
path: root/models/nutrient-target.rkt
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-11-30 13:53:46 +0100
committerMarius Peter <dev@marius-peter.com>2025-11-30 13:53:46 +0100
commit0e0de4a45c10fb2f1ea628f2514cf3f2742db310 (patch)
tree52516a1737c3c150196f30b4c6f0da97a016bdc3 /models/nutrient-target.rkt
parente082bbe3d61f1186c5758b2be61f793c75dd2439 (diff)
Insist on grouped-row naming convention.
Diffstat (limited to 'models/nutrient-target.rkt')
-rw-r--r--models/nutrient-target.rkt9
1 files changed, 4 insertions, 5 deletions
diff --git a/models/nutrient-target.rkt b/models/nutrient-target.rkt
index f850d65..bb89273 100644
--- a/models/nutrient-target.rkt
+++ b/models/nutrient-target.rkt
@@ -74,8 +74,8 @@
(as nutrients n)
#:on (= n.id nv.nutrient_id))))
-(define (grouped-row->nutrient-target row)
- (match-define (vector nt-id target-date residuals) row)
+(define (grouped-row->nutrient-target grouped-row)
+ (match-define (vector nt-id target-date residuals) grouped-row)
(nutrient-target nt-id target-date (residuals->nutrient-value-hash residuals)))
(define (get-nutrient-targets)
@@ -92,8 +92,7 @@
#:order-by nt.target_date
#:desc)
#:group '#(0 1)))
- (for/list ([row grouped-rows])
- (grouped-row->nutrient-target row)))
+ (map grouped-row->nutrient-target grouped-rows))
(define (get-nutrient-target #:id [nt-id #f] #:date [target-date #f])
(define where
@@ -119,7 +118,7 @@
#:group '#(0 1)))
(match grouped-rows
['() #f]
- [(list row) (grouped-row->nutrient-target row)]
+ [(list grouped-row) (grouped-row->nutrient-target grouped-row)]
[many (error 'get-nutrient-target "expected 1 nutrient target, got ~a" (length many))]))
(define (get-nutrient-target-values nt-or-id)
Copyright 2019--2026 Marius PETER