backend: allow optional limit for import!

Johannes Lötzsch 2022-03-16 21:54:21 +01:00
parent e31d2cfb92
commit 3614d299f3
1 changed files with 9 additions and 6 deletions

View File

@ -5,7 +5,9 @@
[ :as lifeline]
[ :as warhelp]))
(defn import! []
(defn import!
([] (import! ##Inf))
(if-not (:import-ngo env)
(println "No IMPORT_NGO defined")
(let [table (if-not (:import-file env)
@ -15,13 +17,14 @@
(lifeline/importfile->table (:import-file env))
(warhelp/importfile->table (:import-file env))
(println "Records to be imported:" (count table))
(update-offers (:import-ngo env) table)
(println "import finished :)"))))
table-limited (take limit table)]
(println "Records to be imported:" (count table-limited))
(update-offers (:import-ngo env) table-limited)
(println "import finished :)")))))
(import! 10)
(require '[beherbergung.db.state :refer [db_ctx]])
(let [ngo:id "warhelp_beherbergung"