improves performance of running balance cache

This commit is contained in:
2023-10-31 08:35:33 -07:00
parent 1f48970200
commit 425a995755

View File

@@ -399,15 +399,15 @@
(defn accounts-needing-rebuild [ db client] (defn accounts-needing-rebuild [ db client]
(let [client (pull-id db client)] (let [client (pull-id db client)]
(->> (dc/qseq {:query '[:find ?c ?a ?l (min ?d) (->> (dc/qseq {:query '[:find ?c ?a ?l (min ?d)
:in $ ?c :in $ $recent ?c
:where :where
[?jel :journal-entry-line/dirty true] [$recent ?jel :journal-entry-line/dirty true]
[?jel :journal-entry-line/account ?a] [?jel :journal-entry-line/account ?a]
[?jel :journal-entry-line/location ?l] [?jel :journal-entry-line/location ?l]
[?je :journal-entry/line-items ?jel] [?je :journal-entry/line-items ?jel]
[?je :journal-entry/client ?c] [?je :journal-entry/client ?c]
[?je :journal-entry/date ?d]] [?je :journal-entry/date ?d]]
:args [db client]}) :args [db (dc/since db (c/to-date (t/plus (t/now) (t/hours -8)))) client]})
(map (fn [[client account location starting-at ]] (map (fn [[client account location starting-at ]]
{:client client {:client client
:account account :account account