diff options
Diffstat (limited to 'db/seed.rkt')
| -rw-r--r-- | db/seed.rkt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/db/seed.rkt b/db/seed.rkt index 8500a4b..3c3f018 100644 --- a/db/seed.rkt +++ b/db/seed.rkt @@ -86,11 +86,12 @@ (define n (get-nutrient #:formula formula)) (define v (string->number (cdr crop-requirement))) (values n v))) - (cond - [(non-empty-string? crop-name) - (define crop (get-crop #:name crop-name)) - (create-crop-requirement! profile nutrient-values crop)] - [else (create-crop-requirement! profile nutrient-values)])) + (unless (get-crop-requirement #:profile profile) + (cond + [(non-empty-string? crop-name) + (define crop (get-crop #:name crop-name)) + (create-crop-requirement! profile nutrient-values crop)] + [else (create-crop-requirement! profile nutrient-values)]))) (with-tx (csv-for-each row->seed! next-row))) (define (seed-initial-crop-rotation!) @@ -111,7 +112,8 @@ (define n (get-nutrient #:formula (car fertilizer-component))) (define v (string->number (cdr fertilizer-component))) (values n v))) - (create-fertilizer-product! canonical-name brand-name nutrient-values)) + (unless (get-fertilizer-product #:canonical-name canonical-name) + (create-fertilizer-product! canonical-name brand-name nutrient-values))) (with-tx (csv-for-each row->seed! next-row))) (module+ test |