diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-30 13:53:46 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-30 13:53:46 +0100 |
| commit | 0e0de4a45c10fb2f1ea628f2514cf3f2742db310 (patch) | |
| tree | 52516a1737c3c150196f30b4c6f0da97a016bdc3 /models/nutrient-target.rkt | |
| parent | e082bbe3d61f1186c5758b2be61f793c75dd2439 (diff) | |
Insist on grouped-row naming convention.
Diffstat (limited to 'models/nutrient-target.rkt')
| -rw-r--r-- | models/nutrient-target.rkt | 9 |
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) |