so many bug fixes.
This commit is contained in:
@@ -184,7 +184,6 @@
|
||||
(:entries args))
|
||||
all-vendors (into all-vendors new-hidden-vendors)
|
||||
all-accounts (transduce (map (comp str :account/numeric-code)) conj #{} (a/get-accounts))
|
||||
_ (println all-accounts)
|
||||
transaction (doall (map
|
||||
(assoc-error (fn [entry]
|
||||
(let [entry (-> entry
|
||||
@@ -202,6 +201,8 @@
|
||||
(throw (Exception. (str "Client '" (:client_code entry )"' not found.")) ))
|
||||
(when-not vendor
|
||||
(throw (Exception. (str "Vendor '" (:vendor_name entry) "' not found."))))
|
||||
(when-not (re-find #"\d{1,2}/\d{1,2}/\d{4}" (:date entry))
|
||||
(throw (Exception. (str "Date must be MM/dd/yyyy"))))
|
||||
(when-not (dollars= (doto (reduce + 0.0 (map :debit (:line_items entry))))
|
||||
(reduce + 0.0 (map :credit (:line_items entry))))
|
||||
(throw (Exception. (str "Debits '"
|
||||
@@ -249,6 +250,7 @@
|
||||
success (filter (comp not :error) transaction)
|
||||
retraction (mapv (fn [x] [:db/retractEntity [:journal-entry/external-id (:journal-entry/external-id x)]])
|
||||
success)]
|
||||
(println (take 4 success))
|
||||
(run! (fn [batch] (println "transacting retraction batch") @(d/transact (d/connect uri) batch)) (partition-all 100 retraction))
|
||||
(run! (fn [batch] (println "transacting success batch") @(d/transact (d/connect uri) batch)) (partition-all 100 success))
|
||||
{:successful (map (fn [x] {:external_id (:journal-entry/external-id x)}) success)
|
||||
|
||||
Reference in New Issue
Block a user