Fixes a few issues discovered

This commit is contained in:
2023-05-13 23:36:14 -07:00
parent 8bd73b8a98
commit 3ce9cceee0
6 changed files with 74 additions and 69 deletions

View File

@@ -6,6 +6,7 @@
[auto-ap.datomic.transaction-rules :as tr]
[auto-ap.datomic.transactions :as d-transactions]
[auto-ap.rule-matching :as rm]
[auto-ap.solr :as solr]
[auto-ap.time :as atime]
[auto-ap.utils :refer [dollars=]]
[clj-time.coerce :as coerce]
@@ -13,8 +14,7 @@
[clojure.core.cache :as cache]
[clojure.tools.logging :as log]
[datomic.api :as dc]
[digest :as di]
[auto-ap.solr :as solr]))
[digest :as di]))
(defn rough-match [client-id bank-account-id amount]
(if (and client-id bank-account-id amount)
@@ -219,7 +219,8 @@
:transaction/vendor (:db/id (:payment/vendor existing-payment))
:transaction/location "A"
:transaction/accounts [#:transaction-account
{:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
{:db/id (random-tempid)
:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
:location "A"
:amount (Math/abs (double amount))}])))
@@ -234,7 +235,8 @@
(assoc transaction
:transaction/expected-deposit {:db/id (:db/id expected-deposit)
:expected-deposit/status :expected-deposit-status/cleared}
:transaction/accounts [{:transaction-account/account :account/ccp
:transaction/accounts [{:db/id (random-tempid)
:transaction-account/account :account/ccp
:transaction-account/amount amount
:transaction-account/location "A"}]
:transaction/approval-status :transaction-approval-status/approved
@@ -242,7 +244,7 @@
))))
(defn maybe-code [{:transaction/keys [client amount] :as transaction} apply-rules valid-locations]
(when (seq (match-transaction-to-unpaid-invoices amount client))
(when-not (seq (match-transaction-to-unpaid-invoices amount client))
(apply-rules transaction valid-locations)))
(defn transaction->txs [transaction bank-account apply-rules]
@@ -323,7 +325,7 @@
:import-batch/entry (:db/id transaction)}]
{:user/name user
:user/role ":admin"})]
(doseq [n (:tempids result)]
(doseq [[_ n] (:tempids result)]
(solr/touch-with-ledger n))))))
(get-stats [_]