diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-20 14:08:21 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-20 14:08:21 +0100 |
| commit | d2b7a6a7e2739869f8b718c80cad7c9515f10070 (patch) | |
| tree | d3e8ac04dc4d1178fe24bc0511ada49caadf25db /db/seed.rkt | |
| parent | 434b521ddb70287b55d1dc8f5e24f18aeaa01fdc (diff) | |
Replace nutrient-value alists with hashes everywhere.
Diffstat (limited to 'db/seed.rkt')
| -rw-r--r-- | db/seed.rkt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/db/seed.rkt b/db/seed.rkt index 881b9ef..7176c89 100644 --- a/db/seed.rkt +++ b/db/seed.rkt @@ -50,11 +50,11 @@ (define row-alist (map cons header row)) (define measured-on (cdr (first row-alist))) (define nutrient-values - (for/list ([nm (in-list (cdr row-alist))]) + (for/hash ([nm (in-list (cdr row-alist))]) (define formula (car nm)) (define n (get-nutrient #:formula formula)) (define v (string->number (cdr nm))) - (cons n v))) + (values n v))) (create-nutrient-measurement! measured-on nutrient-values)) (with-tx (csv-for-each row->seed! next-row))) @@ -75,11 +75,11 @@ (define crop-name (string-downcase (cdr (assoc "Plante" row-alist)))) (define profile (cdr (assoc "Profil" row-alist))) (define nutrient-values - (for/list ([crop-requirement (in-list (list-tail row-alist 2))]) + (for/hash ([crop-requirement (in-list (list-tail row-alist 2))]) (define formula (car crop-requirement)) (define n (get-nutrient #:formula formula)) (define v (string->number (cdr crop-requirement))) - (cons n v))) + (values n v))) (cond [(non-empty-string? crop-name) (define crop (get-crop #:name crop-name)) @@ -96,11 +96,11 @@ (define canonical-name (cdr (assoc "Libellé" row-alist))) (define brand-name (cdr (assoc "Nom commercial" row-alist))) (define nutrient-values - (for/list ([fertilizer-component (in-list (list-tail row-alist 3))]) + (for/hash ([fertilizer-component (in-list (list-tail row-alist 3))]) (define formula (car fertilizer-component)) (define n (get-nutrient #:formula formula)) (define v (string->number (cdr fertilizer-component))) - (cons n v))) + (values n v))) (cond [(non-empty-string? brand-name) (create-fertilizer-product! canonical-name nutrient-values brand-name)] |