Less error prone
This commit is contained in:
@@ -67,8 +67,8 @@
|
||||
(header-row "City2")])
|
||||
|
||||
account-number (some-> account-number Long/parseLong str)
|
||||
matching-client (and account-number
|
||||
(parse/best-match clients account-number 0.0))
|
||||
[matching-client similarity] (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
|
||||
@@ -80,16 +80,18 @@
|
||||
"yyMMdd")]
|
||||
(log/infof "Importing %s for %s" (header-row "InvoiceNumber") (header-row "CustomerName"))
|
||||
|
||||
(code-invoice #:invoice {:invoice-number (header-row "InvoiceNumber")
|
||||
:total (+ total tax)
|
||||
:outstanding-balance (+ total tax)
|
||||
:location (parse/best-location-match matching-client location-hint location-hint )
|
||||
:date (coerce/to-date date)
|
||||
:vendor (:db/id sysco-vendor )
|
||||
:client (:db/id matching-client)
|
||||
:import-status :import-status/completed
|
||||
:status :invoice-status/unpaid
|
||||
:client-identifier customer-identifier})))
|
||||
(cond-> #:invoice {:invoice-number (header-row "InvoiceNumber")
|
||||
:total (+ total tax)
|
||||
:outstanding-balance (+ total tax)
|
||||
:location (parse/best-location-match matching-client location-hint location-hint )
|
||||
:date (coerce/to-date date)
|
||||
:vendor (:db/id sysco-vendor )
|
||||
:client (:db/id matching-client)
|
||||
:import-status :import-status/completed
|
||||
:status :invoice-status/unpaid
|
||||
:client-identifier customer-identifier}
|
||||
similarity (assoc :invoice/similarity (- 1.0 (double similarity)))
|
||||
true (code-invoice))))
|
||||
|
||||
(defn mark-key [k]
|
||||
(s3/copy-object {:source-bucket-name bucket-name
|
||||
|
||||
Reference in New Issue
Block a user