Makes transaction pencil much faster.
This commit is contained in:
@@ -14,15 +14,21 @@
|
||||
(defn <-datomic [result]
|
||||
result)
|
||||
|
||||
(def default-read '[*
|
||||
(def default-read '[:db/id
|
||||
:transaction-rule/description
|
||||
:transaction-rule/note
|
||||
:transaction-rule/amount-lte
|
||||
:transaction-rule/amount-gte
|
||||
:transaction-rule/dom-lte
|
||||
:transaction-rule/dom-gte
|
||||
{:transaction-rule/client [:client/name :db/id :client/code]}
|
||||
{:transaction-rule/bank-account [*]}
|
||||
{:transaction-rule/bank-account [:db/id :bank-account/name]}
|
||||
{:transaction-rule/yodlee-merchant [:db/id :yodlee-merchant/name :yodlee-merchant/yodlee-id]}
|
||||
{:transaction-rule/transaction-approval-status [:db/id :db/ident]}
|
||||
{:transaction-rule/vendor [:vendor/name :db/id :vendor/default-account]}
|
||||
{:transaction-rule/accounts [:transaction-rule-account/percentage
|
||||
:transaction-rule-account/location
|
||||
{:transaction-rule-account/account [*]}
|
||||
{:transaction-rule-account/account [:account/name :db/id :account/numeric-code :account/location]}
|
||||
:db/id]}])
|
||||
|
||||
(defn raw-graphql-ids [db args]
|
||||
@@ -107,3 +113,16 @@
|
||||
:in ['$]
|
||||
:where ['[?e :transaction-rule/transaction-approval-status]]}
|
||||
:args [(dc/db conn)]})))
|
||||
|
||||
(defn get-all-for-client [client-id]
|
||||
(mapv first
|
||||
(dc/q '[:find (pull ?e read)
|
||||
:in $ ?c read
|
||||
:where
|
||||
[?e :transaction-rule/transaction-approval-status]
|
||||
(or-join [?e ?c]
|
||||
[?e :transaction-rule/client ?c]
|
||||
(not [?e :transaction-rule/client]))]
|
||||
(dc/db conn)
|
||||
client-id
|
||||
default-read)))
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
[auto-ap.utils :refer [dollars=]]
|
||||
[clj-time.coerce :as c]
|
||||
[clojure.string :as str]
|
||||
[datomic.client.api :as dc]))
|
||||
[datomic.client.api :as dc]
|
||||
[com.brunobonacci.mulog :as mu]))
|
||||
|
||||
(defn get-transaction-rule-page [context args _]
|
||||
(let [args (assoc args :id (:id context))
|
||||
@@ -27,8 +28,12 @@
|
||||
|
||||
(defn get-transaction-rule-matches [context args _]
|
||||
(if (= "admin" (:user/role (:id context)))
|
||||
(let [all-rules (tr/get-all)
|
||||
transaction (update (d-transactions/get-by-id (:transaction_id args)) :transaction/date c/to-date)]
|
||||
(let [transaction (update (d-transactions/get-by-id (:transaction_id args)) :transaction/date c/to-date)
|
||||
all-rules (tr/get-all-for-client (:db/id (:transaction/client transaction)))
|
||||
|
||||
]
|
||||
(mu/log ::counted
|
||||
:count (count all-rules))
|
||||
(map ->graphql (rm/get-matching-rules transaction all-rules)))
|
||||
nil))
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
(printf "%s - %s: %s\n" (:mulog/namespace item) (:mulog/event-name item)
|
||||
(pr-str (reduce
|
||||
(fn [acc [k v]]
|
||||
(if (= "mulog" (namespace k))
|
||||
acc
|
||||
(assoc acc k v)))
|
||||
(assoc acc k v))
|
||||
{}
|
||||
item))))
|
||||
|
||||
|
||||
@@ -165,11 +165,6 @@
|
||||
|
||||
(when-not is-initial-loading
|
||||
[:div.navbar-end
|
||||
|
||||
[:a.navbar-item {:href "/company/1099"}
|
||||
[:div.tag.is-info.is-rounded
|
||||
"1099 data entry is now ready!"]]
|
||||
|
||||
(when (> (count @clients) 1)
|
||||
[client-dropdown])])]
|
||||
(when-not is-initial-loading
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
:invoice/total 39.88
|
||||
:invoice/outstanding-balance 39.88
|
||||
}]
|
||||
(map #(dissoc % :invoice/expense-accounts)
|
||||
(map #(dissoc % :invoice/expense-accounts :db/id)
|
||||
(sut/extract-invoice-details "ntg-invoices/Cintas/123"
|
||||
(io/input-stream (io/resource "test-cintas/o.zcic.230310093903"))
|
||||
[client]))))))
|
||||
|
||||
Reference in New Issue
Block a user