fixes issues with a neverending search. Also fixes client saving to match normal test.

This commit is contained in:
2023-03-24 13:01:33 -07:00
parent 7fd3528d0f
commit 4f94602716
8 changed files with 112 additions and 87 deletions

View File

@@ -588,6 +588,7 @@
account
location]
(take 3 (:journal-entry-line/client+account+location+date result)))))
(take 5)
(drop-while (fn [{[_ _ _ date] :journal-entry-line/client+account+location+date}]
(>= (compare date starting-at) 0)))
first
@@ -595,31 +596,33 @@
0.0)))
(defn get-dirty-entries [{:keys [client account location starting-at]} db ]
(mu/trace ::get-dirty-entries
[]
(let [client (pull-id db client)
account (pull-id db account)]
(into []
(comp
(mapcat (fn [i]
(dc/index-pull db
{:index :avet
:selector [:db/id :journal-entry-line/debit :journal-entry-line/credit :journal-entry-line/client+account+location+date]
:start [:journal-entry-line/client+account+location+date
[client account location starting-at]]
:offset (* i 1000)
:limit 1000}
))
)
(take-while (fn [{[result-client result-account result-location] :journal-entry-line/client+account+location+date}]
(and
(= client result-client)
(= account result-account)
(= location result-location))))
(map (fn [result]
[(:db/id result) (:journal-entry-line/debit result 0.0) (:journal-entry-line/credit result 0.0) ])))
(range)))))
(let [client (pull-id db client)
account (pull-id db account)]
(into []
(comp
(map (fn [i]
(dc/index-pull db
{:index :avet
:selector [:db/id :journal-entry-line/debit :journal-entry-line/credit :journal-entry-line/client+account+location+date]
:start [:journal-entry-line/client+account+location+date
[client account location starting-at]]
:offset (* i 1000)
:limit 1000}
)))
(take-while identity)
(mapcat identity)
(take-while (fn [{[result-client result-account result-location] :journal-entry-line/client+account+location+date}]
#_(println
[[ client result-client]
[ account result-account]
[ location result-location]])
(and
(= client result-client)
(= account result-account)
(= location result-location))))
(map (fn [result]
[(:db/id result) (:journal-entry-line/debit result 0.0) (:journal-entry-line/credit result 0.0) ])))
(range 100))))
(defn compute-running-balance [account-needing-refresh]
(mu/trace ::compute