diff --git a/src/clj/auto_ap/square/core.clj b/src/clj/auto_ap/square/core.clj index 3ae4359f..8292abdb 100644 --- a/src/clj/auto_ap/square/core.clj +++ b/src/clj/auto_ap/square/core.clj @@ -408,19 +408,9 @@ ([client location] (lc/with-context {:source "Square settlements loading"} (try - (let [existing (->> (d/query {:query {:find ['?external-id] - :in ['$ '?client] - :where ['[?d :expected-deposit/client ?client] - '[?d :expected-deposit/external-id ?external-id]]} - :args [(d/db conn) (:db/id client)]}) - (map first) - set) - _ (log/info (count existing) "settlements already exist") - to-create (filter #(not (existing (:expected-deposit/external-id %))) - (daily-settlements client location))] - (doseq [x (partition-all 20 to-create)] - (log/info "Loading expected deposit" (count x)) - @(d/transact conn x))) + (doseq [x (partition-all 20 (daily-settlements client location))] + (log/info "Loading expected deposit" (count x)) + @(d/transact conn x)) (catch Exception e (log/error e))) (log/info "Done loading settlements")))) @@ -435,19 +425,9 @@ :client (:client/code client) :location (:square-location/client-location client)} (try - (let [existing (->> (d/query {:query {:find ['?external-id] - :in ['$ '?client] - :where ['[?r :sales-refund/client ?client] - '[?r :sales-refund/external-id ?external-id]]} - :args [(d/db conn) (:db/id client)]}) - (map first) - set) - _ (log/info (count existing) "refunds already exist") - to-create (filter #(not (existing (:sales-refund/external-id %))) - (refunds client location))] - (doseq [x (partition-all 20 to-create)] - (log/info "Loading refund" (count x)) - @(d/transact conn x))) + (doseq [x (partition-all 20 (refunds client location))] + (log/info "Loading refund" (count x)) + @(d/transact conn x)) (catch Exception e (log/error e))) (log/info "Done loading refunds"))))