added suggestions
This commit is contained in:
@@ -42,37 +42,6 @@
|
||||
journal-entries)]
|
||||
(result->page journal-entries journal-entries-count :journal_entries (:filters args))))
|
||||
|
||||
;; TODO a better way to do this might be to accumulate ALL credits and ALL debits, and then just do for credits: balance = credits - debits. and for debits balance = debits - credits
|
||||
(defn credit-account? [account]
|
||||
(or
|
||||
(#{:account-type/liability
|
||||
:account-type/equity
|
||||
:account-type/revenue}
|
||||
(:db/ident (:account/type account)))
|
||||
(#{:bank-account-type/credit}
|
||||
(-> account :bank-account/type :db/ident ))))
|
||||
|
||||
(defn debit-account? [account]
|
||||
|
||||
(or (#{:account-type/asset
|
||||
:account-type/dividend
|
||||
:account-type/expense}
|
||||
(:db/ident (:account/type account)))
|
||||
(#{:bank-account-type/check :bank-account-type/cash}
|
||||
(-> account :bank-account/type :db/ident ))))
|
||||
|
||||
(defn expense-account? [account]
|
||||
(= :account-type/expense (:db/ident (:account/type account))))
|
||||
|
||||
(defn account-name [account client]
|
||||
(let [overriden-name (->>
|
||||
(:account/client-overrides account)
|
||||
(filter (fn [co]
|
||||
(= (:db/id (:account-client-override/client co)) (:db/id client))))
|
||||
(map :account-client-override/name)
|
||||
first)]
|
||||
|
||||
(or overriden-name (:account/name account))))
|
||||
|
||||
(defn roll-up-until
|
||||
([lookup-account all-ledger-entries end-date]
|
||||
@@ -527,6 +496,7 @@
|
||||
(build-running-balance-cache))
|
||||
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(mount/defstate running-balance-cache-worker
|
||||
:start (scheduler/every (* 15 60 1000) (heartbeat refresh-running-balance-cache "running-balance-cache"))
|
||||
:stop (scheduler/stop running-balance-cache-worker))
|
||||
|
||||
Reference in New Issue
Block a user