Should give a bit more clarity if refunds don't load

This commit is contained in:
2023-03-03 10:03:16 -08:00
parent eb87367e8b
commit 0ff147a7a0

View File

@@ -589,19 +589,27 @@
([client] ([client]
(apply de/zip (apply de/zip
(for [square-location (:client/square-locations client) (for [square-location (:client/square-locations client)
:when (:square-location/client-location square-location)] :when (:square-location/client-location square-location)]
(upsert-refunds client square-location)))) (upsert-refunds client square-location))))
([client location] ([client location]
(de/chain (refunds client location) (with-context-as {:source "Square refunds loading"
(fn [refunds] :client (:client/code client)} lc
(mu/with-context {:source "Loading Square Settlements"
:client (:client/code client) (de/chain (refunds client location)
:location (:square-location/client-location client)} (fn [refunds]
(doseq [x (partition-all 100 refunds)] (mu/with-context lc
(log/info ::loading-refunds (try
:count (count x)) (doseq [x (partition-all 100 refunds)]
@(d/transact conn x)) (log/info ::loading-refunds
(log/info ::done-loading-refunds)))))) :count (count x)
:sample (first x))
@(d/transact conn x))
(catch Throwable e
(log/error ::upsert-refunds-failed
:exception e)))
(log/info ::done-loading-refunds)))))))
(def square-read [:db/id (def square-read [:db/id
:client/code :client/code