From 93663472451463090c39159100b79c1575fbaf13 Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 23 May 2023 16:36:07 -0700 Subject: [PATCH] fixes load from historical sales. --- src/clj/auto_ap/import/common.clj | 4 ++-- src/clj/auto_ap/import/transactions.clj | 10 +++++----- src/clj/auto_ap/square/core3.clj | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/clj/auto_ap/import/common.clj b/src/clj/auto_ap/import/common.clj index 78a90d84..00bca837 100644 --- a/src/clj/auto_ap/import/common.clj +++ b/src/clj/auto_ap/import/common.clj @@ -11,7 +11,7 @@ (defn wrap-integration [f bank-account] (try (let [result (f)] - @(dc/transact conn [{:db/id bank-account + @(dc/transact-async conn [{:db/id bank-account :bank-account/integration-status {:db/id (bank-account->integration-id bank-account) :integration-status/state :integration-state/success @@ -19,7 +19,7 @@ :integration-status/last-updated (java.util.Date.)}}]) result) (catch Exception e - @(dc/transact conn [{:db/id bank-account + @(dc/transact-async conn [{:db/id bank-account :bank-account/integration-status {:db/id (bank-account->integration-id bank-account) :integration-status/state :integration-state/failed diff --git a/src/clj/auto_ap/import/transactions.clj b/src/clj/auto_ap/import/transactions.clj index 706f3332..d2bd62d6 100644 --- a/src/clj/auto_ap/import/transactions.clj +++ b/src/clj/auto_ap/import/transactions.clj @@ -296,7 +296,7 @@ :import-batch/not-ready 0 :import-batch/extant 0}) 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/source source :import-batch/status :import-status/started @@ -334,10 +334,10 @@ (fail! [_ error] (log/errorf "Couldn't complete import %d with error." import-id) (log/error error) - @(dc/transact conn [(merge {:db/id import-id - :import-batch/status :import-status/completed - :import-batch/error-message (str error)} - @stats)])) + @(dc/transact-async conn [(merge {:db/id import-id + :import-batch/status :import-status/completed + :import-batch/error-message (str error)} + @stats)])) (finish! [_] (log/infof "Finishing import batch %d for %s with stats %s " import-id (name source) (pr-str @stats)) diff --git a/src/clj/auto_ap/square/core3.clj b/src/clj/auto_ap/square/core3.clj index 23c477d7..17d32aa0 100644 --- a/src/clj/auto_ap/square/core3.clj +++ b/src/clj/auto_ap/square/core3.clj @@ -394,7 +394,7 @@ (-> (de/chain (search client location start end) (fn [search-results] - (->> search-results + (->> (or search-results []) (s/->source) (s/filter (fn [order] ;; sometimes orders stay open in square. At least one payment