speeds up
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
[auto-ap.datomic.transactions :as d-transactions]
|
[auto-ap.datomic.transactions :as d-transactions]
|
||||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||||
|
[auto-ap.logging :as alog]
|
||||||
[auto-ap.query-params :as query-params]
|
[auto-ap.query-params :as query-params]
|
||||||
[auto-ap.routes.admin.transaction-rules :as route]
|
[auto-ap.routes.admin.transaction-rules :as route]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
@@ -20,15 +21,13 @@
|
|||||||
[auto-ap.ssr.form-cursor :as fc]
|
[auto-ap.ssr.form-cursor :as fc]
|
||||||
[auto-ap.ssr.grid-page-helper :as helper]
|
[auto-ap.ssr.grid-page-helper :as helper]
|
||||||
[auto-ap.ssr.hx :as hx]
|
[auto-ap.ssr.hx :as hx]
|
||||||
[auto-ap.ssr.nested-form-params :refer [wrap-nested-form-params]]
|
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.utils
|
||||||
:refer [apply-middleware-to-all-handlers entity-id
|
:refer [apply-middleware-to-all-handlers entity-id
|
||||||
field-validation-error form-validation-error
|
field-validation-error form-validation-error
|
||||||
html-response main-transformer many-entity modal-response
|
html-response many-entity modal-response money percentage
|
||||||
money percentage ref->enum-schema ref->radio-options
|
ref->enum-schema ref->radio-options regex temp-id
|
||||||
regex temp-id wrap-entity wrap-form-4xx-2
|
wrap-entity wrap-schema-enforce]]
|
||||||
wrap-schema-enforce]]
|
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[auto-ap.utils :refer [dollars=]]
|
[auto-ap.utils :refer [dollars=]]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
@@ -307,15 +306,19 @@
|
|||||||
:in ['$ 'read]
|
:in ['$ 'read]
|
||||||
:where []}
|
:where []}
|
||||||
:args [(dc/db conn) transaction-read]}
|
:args [(dc/db conn) transaction-read]}
|
||||||
|
|
||||||
|
only-uncoded?
|
||||||
|
(merge-query {:query {:where ['[?e :transaction/approval-status :transaction-approval-status/unapproved]]}})
|
||||||
|
(not only-uncoded?)
|
||||||
|
(merge-query {:query {:where '[[(iol-ion.query/recent-date 60) ?start-date]
|
||||||
|
[?e :transaction/date ?d]
|
||||||
|
[(>= ?d ?start-date)]]}})
|
||||||
|
|
||||||
description
|
description
|
||||||
(merge-query {:query {:in ['?descr]
|
(merge-query {:query {:in ['?descr]
|
||||||
:where ['[(iol-ion.query/->pattern ?descr) ?description-regex]]}
|
:where ['[(iol-ion.query/->pattern ?descr) ?description-regex]]}
|
||||||
:args [description]})
|
:args [description]})
|
||||||
client-group
|
|
||||||
(merge-query {:query {:in ['?client-group]
|
|
||||||
:where ['[?e :transaction/client ?client-group-client]
|
|
||||||
'[?client-group-client :client/groups ?client-group]]}
|
|
||||||
:args [client-group]})
|
|
||||||
valid-clients
|
valid-clients
|
||||||
(merge-query {:query {:in ['[?xx ...]]
|
(merge-query {:query {:in ['[?xx ...]]
|
||||||
:where ['[?e :transaction/client ?xx]]}
|
:where ['[?e :transaction/client ?xx]]}
|
||||||
@@ -330,6 +333,12 @@
|
|||||||
(merge-query {:query {:where ['[?e :transaction/description-original ?do]
|
(merge-query {:query {:where ['[?e :transaction/description-original ?do]
|
||||||
'[(re-find ?description-regex ?do)]]}})
|
'[(re-find ?description-regex ?do)]]}})
|
||||||
|
|
||||||
|
client-group
|
||||||
|
(merge-query {:query {:in ['?client-group]
|
||||||
|
:where ['[?e :transaction/client ?client-group-client]
|
||||||
|
'[?client-group-client :client/groups ?client-group]]}
|
||||||
|
:args [client-group]})
|
||||||
|
|
||||||
amount-gte
|
amount-gte
|
||||||
(merge-query {:query {:in ['?amount-gte]
|
(merge-query {:query {:in ['?amount-gte]
|
||||||
:where ['[?e :transaction/amount ?ta]
|
:where ['[?e :transaction/amount ?ta]
|
||||||
@@ -356,12 +365,11 @@
|
|||||||
'[(>= ?dom ?dom-gte)]]}
|
'[(>= ?dom ?dom-gte)]]}
|
||||||
:args [dom-gte]})
|
:args [dom-gte]})
|
||||||
|
|
||||||
only-uncoded?
|
|
||||||
(merge-query {:query {:where ['[or [?e :transaction/approval-status :transaction-approval-status/unapproved]
|
|
||||||
[(missing? $ ?e :transaction/approval-status)]]]}})
|
|
||||||
|
|
||||||
true
|
true
|
||||||
(merge-query {:query {:where ['[?e :transaction/id]]}}))
|
(merge-query {:query {:where ['[?e :transaction/id]]}}))
|
||||||
|
_ (alog/peek query)
|
||||||
results (->>
|
results (->>
|
||||||
(query2 query)
|
(query2 query)
|
||||||
(map first))]
|
(map first))]
|
||||||
|
|||||||
Reference in New Issue
Block a user