only including accounts that the client actually uses.
This commit is contained in:
@@ -482,22 +482,12 @@
|
|||||||
:in $
|
:in $
|
||||||
:where [?i :account/location ?l]]
|
:where [?i :account/location ?l]]
|
||||||
(dc/db conn))))
|
(dc/db conn))))
|
||||||
used-accounts (->> (for [c clients
|
|
||||||
d (dc/index-range (dc/db conn)
|
|
||||||
:journal-entry-line/client+account+location+date
|
|
||||||
[(:db/id c)]
|
|
||||||
[(inc (:db/id c))])
|
|
||||||
:let [[_ account] (:v d)]]
|
|
||||||
account)
|
|
||||||
(into #{})
|
|
||||||
(sort-by account->numeric-code))
|
|
||||||
dates (->> (range -365 0)
|
dates (->> (range -365 0)
|
||||||
(map (fn [delta]
|
(map (fn [delta]
|
||||||
(atime/unparse-local (time/plus (time/floor (time/plus (atime/local-now) (time/days 1)) time/day) (time/days delta))
|
(atime/unparse-local (time/plus (time/floor (time/plus (atime/local-now) (time/days 1)) time/day) (time/days delta))
|
||||||
atime/iso-date))))]
|
atime/iso-date))))]
|
||||||
(alog/info ::account-snapshot-report
|
|
||||||
:used-accounts (count used-accounts)
|
|
||||||
:date-count (count dates))
|
|
||||||
{:status 200
|
{:status 200
|
||||||
:body
|
:body
|
||||||
(for [client clients
|
(for [client clients
|
||||||
@@ -510,6 +500,17 @@
|
|||||||
(take-while (fn matches-client [curr]
|
(take-while (fn matches-client [curr]
|
||||||
(= (first (:journal-entry-line/client+account+location+date curr))
|
(= (first (:journal-entry-line/client+account+location+date curr))
|
||||||
(:db/id client)))))
|
(:db/id client)))))
|
||||||
|
used-accounts (->> (for [d (dc/index-range (dc/db conn)
|
||||||
|
:journal-entry-line/client+account+location+date
|
||||||
|
[(:db/id client)]
|
||||||
|
[(inc (:db/id client))])
|
||||||
|
:let [[_ account] (:v d)]]
|
||||||
|
account)
|
||||||
|
(into #{})
|
||||||
|
(sort-by account->numeric-code))
|
||||||
|
_ (alog/info ::account-snapshot-report
|
||||||
|
:used-accounts (count used-accounts)
|
||||||
|
:date-count (count dates))
|
||||||
account-lookup (->> all-entries
|
account-lookup (->> all-entries
|
||||||
(reduce
|
(reduce
|
||||||
(fn build-account-lookup [acc curr]
|
(fn build-account-lookup [acc curr]
|
||||||
|
|||||||
Reference in New Issue
Block a user