diff options
Diffstat (limited to 'db')
| -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)] |