More grouping.
This commit is contained in:
@@ -44,14 +44,16 @@
|
||||
(defn roll-up [results]
|
||||
(->> results
|
||||
(mapcat :journal-entry/line-items)
|
||||
(group-by :journal-entry-line/account)
|
||||
(reduce-kv (fn [result account line-items]
|
||||
(group-by (juxt :journal-entry-line/account :journal-entry-line/location))
|
||||
(reduce-kv (fn [result [account location] line-items]
|
||||
;; TODO fix
|
||||
(when-not (or (:bank-account/name account) (:account/name account))
|
||||
(println "WARNING " account line-items))
|
||||
(conj result
|
||||
{:name (or (:bank-account/name account) (:account/name account))
|
||||
:id (:db/id account)
|
||||
{:name (str (or (:bank-account/name account) (:account/name account)) (when-not (#{"A" } location)
|
||||
(str
|
||||
"-" location)))
|
||||
:id (str (:db/id account) "-" location)
|
||||
:numeric-code (or (:account/numeric-code account)
|
||||
(and (:bank-account/type account)
|
||||
1100))
|
||||
|
||||
Reference in New Issue
Block a user