This commit is contained in:
2024-09-26 00:11:49 -07:00
parent d86492cd8d
commit 5366c0be59
2 changed files with 29 additions and 12 deletions

View File

@@ -318,7 +318,7 @@
(defprotocol ImportBatch
(import-transaction! [this transaction])
(get-stats [this ])
(get-pending-balance [this])
(get-pending-balance [this bank-account])
(finish! [this])
(fail! [this error]))

View File

@@ -473,13 +473,7 @@
row-changed? (or (not (dollars= new-running-balance extant-running-balance))
dirty)]
[new-running-balance
(conj changed-rows
{:db/id id
:journal-entry-line/running-balance new-running-balance
:journal-entry-line/debit debit
:journal-entry-line/credit credit
:journal-entry-line/dirty false})
#_(if row-changed?
(if row-changed?
(conj changed-rows
{:db/id id
:journal-entry-line/running-balance new-running-balance
@@ -589,6 +583,28 @@
[(<= ?d #inst "2000-01-01")]]
(dc/db conn)))
#_(
(refresh-running-balance-cache)
(accounts-needing-rebuild (dc/db conn) [ :client/code "SCCB"])
(user/init-repl)
(get-entries-to-refresh {:client (pull-id (dc/db conn) [:client/code "SCCB"])
:account (pull-id (dc/db conn) [:bank-account/code "SCCB-USB9598" ])
:location "A"}
(dc/db conn))
(rebuild-running-balance-cache [{:client/code "SCCB" :db/id (pull-id (dc/db conn) [:client/code "SCCB"])}])
(clients-needing-refresh)
(dc/q '[:find (count ?d)
:in $
:where [?d :journal-entry-line/dirty true]
]
(dc/db conn))
)
#_(comment [17592334354011 #inst "0024-08-03T07:52:58.000-00:00"]
[17592302554688 #inst "0023-07-20T07:52:58.000-00:00"]
@@ -602,10 +618,11 @@
[17592334353244 #inst "0024-07-14T07:52:58.000-00:00"])
;; TODO
;; 1. Having an uncategorized running balance
;; 1a. dirty should always be 0
;; 2. rebuild from beginning of history always, only update entry if it currently doesn't match
;; 3. deterministic order (date + entityid)
;; 1. X Having an uncategorized running balance
;; 1a. X dirty should always be 0
;; 2. X rebuild from beginning of history always, only update entry if it currently doesn't match
;; 3. X deterministic order (date + entityid)
;; 4. Check for errors
;; TODO only enable once IOL is set up in clod
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}