fixes load from historical sales.
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
(defn wrap-integration [f bank-account]
|
(defn wrap-integration [f bank-account]
|
||||||
(try
|
(try
|
||||||
(let [result (f)]
|
(let [result (f)]
|
||||||
@(dc/transact conn [{:db/id bank-account
|
@(dc/transact-async conn [{:db/id bank-account
|
||||||
:bank-account/integration-status
|
:bank-account/integration-status
|
||||||
{:db/id (bank-account->integration-id bank-account)
|
{:db/id (bank-account->integration-id bank-account)
|
||||||
:integration-status/state :integration-state/success
|
:integration-status/state :integration-state/success
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
:integration-status/last-updated (java.util.Date.)}}])
|
:integration-status/last-updated (java.util.Date.)}}])
|
||||||
result)
|
result)
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
@(dc/transact conn [{:db/id bank-account
|
@(dc/transact-async conn [{:db/id bank-account
|
||||||
:bank-account/integration-status
|
:bank-account/integration-status
|
||||||
{:db/id (bank-account->integration-id bank-account)
|
{:db/id (bank-account->integration-id bank-account)
|
||||||
:integration-status/state :integration-state/failed
|
:integration-status/state :integration-state/failed
|
||||||
|
|||||||
@@ -296,7 +296,7 @@
|
|||||||
:import-batch/not-ready 0
|
:import-batch/not-ready 0
|
||||||
:import-batch/extant 0})
|
:import-batch/extant 0})
|
||||||
extant-cache (atom (cache/ttl-cache-factory {} :ttl 60000 ))
|
extant-cache (atom (cache/ttl-cache-factory {} :ttl 60000 ))
|
||||||
import-id (get (:tempids @(dc/transact conn [{:db/id "import-batch"
|
import-id (get (:tempids @(dc/transact-async conn [{:db/id "import-batch"
|
||||||
:import-batch/date (coerce/to-date (t/now))
|
:import-batch/date (coerce/to-date (t/now))
|
||||||
:import-batch/source source
|
:import-batch/source source
|
||||||
:import-batch/status :import-status/started
|
:import-batch/status :import-status/started
|
||||||
@@ -334,10 +334,10 @@
|
|||||||
(fail! [_ error]
|
(fail! [_ error]
|
||||||
(log/errorf "Couldn't complete import %d with error." import-id)
|
(log/errorf "Couldn't complete import %d with error." import-id)
|
||||||
(log/error error)
|
(log/error error)
|
||||||
@(dc/transact conn [(merge {:db/id import-id
|
@(dc/transact-async conn [(merge {:db/id import-id
|
||||||
:import-batch/status :import-status/completed
|
:import-batch/status :import-status/completed
|
||||||
:import-batch/error-message (str error)}
|
:import-batch/error-message (str error)}
|
||||||
@stats)]))
|
@stats)]))
|
||||||
|
|
||||||
(finish! [_]
|
(finish! [_]
|
||||||
(log/infof "Finishing import batch %d for %s with stats %s " import-id (name source) (pr-str @stats))
|
(log/infof "Finishing import batch %d for %s with stats %s " import-id (name source) (pr-str @stats))
|
||||||
|
|||||||
@@ -394,7 +394,7 @@
|
|||||||
(->
|
(->
|
||||||
(de/chain (search client location start end)
|
(de/chain (search client location start end)
|
||||||
(fn [search-results]
|
(fn [search-results]
|
||||||
(->> search-results
|
(->> (or search-results [])
|
||||||
(s/->source)
|
(s/->source)
|
||||||
(s/filter (fn [order]
|
(s/filter (fn [order]
|
||||||
;; sometimes orders stay open in square. At least one payment
|
;; sometimes orders stay open in square. At least one payment
|
||||||
|
|||||||
Reference in New Issue
Block a user