Minor fixes.

This commit is contained in:
2022-01-11 17:07:40 -08:00
parent 6c9a3d7ece
commit 4d6b3b1e2e
4 changed files with 76 additions and 11 deletions

View File

@@ -66,10 +66,12 @@
(header-row "City1")
(header-row "City2")])
matching-client (or (and account-number
(parse/best-match clients account-number 0.0))
(and customer-identifier
(parse/best-match clients customer-identifier)))
matching-client (and account-number
(parse/best-match clients account-number 0.0))
_ (when-not matching-client
(throw (ex-info "cannot find matching client"
{:account-number account-number
:name customer-identifier})))
total (Double/parseDouble (summary-row "TotalExtendedPrice"))
tax (Double/parseDouble (summary-row "TotalTaxAmount"))
date (t/parse
@@ -133,10 +135,13 @@
(log/infof "Found %d sysco invoice to import: %s" (count keys) (pr-str keys))
(let [result @(d/transact conn (mapv (fn [k]
(-> k
read-sysco-csv
(extract-invoice-details clients sysco-vendor)
))
(try
(-> k
read-sysco-csv
(extract-invoice-details clients sysco-vendor))
(catch Exception e
(log/error e)
[])))
keys))]
(log/infof "Imported %d invoices" (/ (count (:tempids result)) 2)))
(doseq [k keys]