a number of nice fixes.
This commit is contained in:
@@ -393,3 +393,37 @@
|
||||
|
||||
(defn start-db []
|
||||
(mount.core/start (mount.core/only #{#'auto-ap.datomic/conn})))
|
||||
|
||||
(defn touch-transaction-ledger [e]
|
||||
@(d/transact auto-ap.datomic/conn [[:db/retractEntity [:journal-entry/original-entity e]]])
|
||||
@(d/transact auto-ap.datomic/conn [(auto-ap.ledger/entity-change->ledger (d/db auto-ap.datomic/conn)
|
||||
[:transaction e])]))
|
||||
|
||||
(defn mismatched-transactions []
|
||||
(let [jel-accounts (reduce
|
||||
(fn [acc [e lia]]
|
||||
(update acc e (fnil conj #{} ) lia))
|
||||
{}
|
||||
(d/query {:query {:find ['?e '?lia]
|
||||
:in ['$]
|
||||
:where ['[?je :journal-entry/line-items ?li]
|
||||
'[?je :journal-entry/original-entity ?e]
|
||||
'[?li :journal-entry-line/account ?lia]
|
||||
'[?lia :account/name]]}
|
||||
:args [(d/db auto-ap.datomic/conn)]}))
|
||||
transaction-accounts (reduce
|
||||
(fn [acc [e lia]]
|
||||
(update acc e (fnil conj #{} ) lia))
|
||||
{}
|
||||
(d/query {:query {:find ['?e '?lia]
|
||||
:in ['$]
|
||||
:where ['[?e :transaction/accounts ?li]
|
||||
'(not [?e :transaction/approval-status :transaction-approval-status/excluded])
|
||||
'[?li :transaction-account/account ?lia]
|
||||
|
||||
'[?lia :account/name]]}
|
||||
:args [(d/db auto-ap.datomic/conn)]}))
|
||||
]
|
||||
(filter
|
||||
(fn [[e accounts]] (not= accounts (get jel-accounts e)))
|
||||
transaction-accounts)))
|
||||
|
||||
Reference in New Issue
Block a user