From 0d209829e896b71a4d74821057f7377d63c1388f Mon Sep 17 00:00:00 2001 From: Bryce Date: Fri, 8 Sep 2023 07:15:28 -0700 Subject: [PATCH] reduces the number of duplicates that we try to import. --- src/clj/auto_ap/jobs/ntg.clj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/clj/auto_ap/jobs/ntg.clj b/src/clj/auto_ap/jobs/ntg.clj index 3c925915..6c21fce3 100644 --- a/src/clj/auto_ap/jobs/ntg.clj +++ b/src/clj/auto_ap/jobs/ntg.clj @@ -102,7 +102,14 @@ :db/id (random-tempid) }]}))) (filter :invoice/client) - (into [])) + (reduce (fn [[seen-so-far list] i] + (let [k [(:invoice/invoice-number i) (:invoice/client i)]] + (if (seen-so-far k) + [seen-so-far list] + [(conj seen-so-far k) (conj list i)]))) + [#{} []]) + (second) + ) (catch Exception e (log/error ::cant-import-general-produce :error e)