diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-20 11:27:50 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-20 11:27:50 +0100 |
| commit | e49ca1f3999127bee5888b44c3900b5483ecebd0 (patch) | |
| tree | 66a2e7a2ca48a7fb480d0ded1d8072da2f4b93cf /models/fertilizer-product.rkt | |
| parent | c0f93e8d41188fc4138a350430ee349b61ea0535 (diff) | |
raco fmt.
Diffstat (limited to 'models/fertilizer-product.rkt')
| -rw-r--r-- | models/fertilizer-product.rkt | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/models/fertilizer-product.rkt b/models/fertilizer-product.rkt index 225af10..d4006ac 100644 --- a/models/fertilizer-product.rkt +++ b/models/fertilizer-product.rkt @@ -1,6 +1,5 @@ #lang racket -;; Model struct (provide fertilizer-product fertilizer-product? fertilizer-product-id @@ -8,7 +7,6 @@ [fertilizer-product-nutrient-values fertilizer-product-values] [fertilizer-product-brand-name fertilizer-brand-name]) (contract-out - ;; SQL CRUD [create-fertilizer-product! (->* (string? (listof nutrient-value-pair/c)) (string?) fertilizer-product?)] [get-fertilizer-products (-> (listof fertilizer-product?))] @@ -26,7 +24,6 @@ "../db/conn.rkt" "nutrient.rkt") -;; Instances of this struct are persisted in the fertilizer_products table. (struct fertilizer-product (id canonical-name nutrient-values brand-name) #:transparent #:guard (λ (id canonical-name nutrient-values brand-name _) @@ -161,14 +158,14 @@ n.formula nv.value_ppm #:from (TableExpr:AST ,joined) - #:where (= nm.id ,(fertilizer-product-id fertilizer-product))))]) + #:where (= fp.id ,(fertilizer-product-id fertilizer-product))))]) (cons (nutrient nutrient-id name formula) value_ppm))) (define (get-fertilizer-product-value fertilizer-product nutrient) (query-maybe-value (current-conn) (select value_ppm #:from (TableExpr:AST ,joined) - #:where (and (= nm.id ,(fertilizer-product-id fertilizer-product)) + #:where (and (= fp.id ,(fertilizer-product-id fertilizer-product)) (= nv.nutrient_id ,(nutrient-id nutrient)))))) ;; UPDATE |