Makes imports more resilient
This commit is contained in:
@@ -654,7 +654,7 @@
|
||||
|
||||
(defn audit-transact [txes id]
|
||||
(try
|
||||
@(dc/transact conn (conj txes {:db/id "datomic.tx"
|
||||
@(dc/transact-async conn (conj txes {:db/id "datomic.tx"
|
||||
:audit/user (str (:user/role id) "-" (:user/name id))}))
|
||||
(catch Exception e
|
||||
(mu/log ::transaction-error
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns auto-ap.jobs.ntg
|
||||
(:require
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.datomic :refer [audit-transact conn]]
|
||||
[auto-ap.datomic :refer [audit-transact conn random-tempid]]
|
||||
[auto-ap.jobs.core :refer [execute]]
|
||||
[auto-ap.logging :as log]
|
||||
[auto-ap.parse :as parse]
|
||||
@@ -81,7 +81,8 @@
|
||||
(log/warn ::missing-client
|
||||
:client-hint location-hint)
|
||||
(swap! missing-client-hints conj location-hint))
|
||||
{:invoice/location location
|
||||
{:db/id (random-tempid)
|
||||
:invoice/location location
|
||||
:invoice/date (coerce/to-date (atime/parse ship-date atime/normal-date))
|
||||
:invoice/invoice-number invoice-number
|
||||
:invoice/total (Double/parseDouble invoice-total)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.jobs.core :refer [execute]]
|
||||
[auto-ap.datomic :refer [audit-transact]]
|
||||
[auto-ap.datomic :refer [audit-transact random-tempid]]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.invoices :refer [code-invoice]]
|
||||
[auto-ap.parse :as parse]
|
||||
@@ -80,6 +80,7 @@
|
||||
(log/infof "Importing %s for %s" (header-row "InvoiceNumber") (header-row "CustomerName"))
|
||||
|
||||
(cond-> #:invoice {:invoice-number (header-row "InvoiceNumber")
|
||||
:db/id (random-tempid)
|
||||
:total (+ total tax)
|
||||
:outstanding-balance (+ total tax)
|
||||
:location (parse/best-location-match (dc/pull (dc/db conn)
|
||||
|
||||
Reference in New Issue
Block a user