Fixes a few issues discovered

This commit is contained in:
2023-05-13 23:36:14 -07:00
parent 8bd73b8a98
commit 3ce9cceee0
6 changed files with 74 additions and 69 deletions

View File

@@ -6,24 +6,23 @@
(str (UUID/randomUUID)))
(defn get-line-items-after [db journal-entry]
(for [jel (:journal-entry/line-items journal-entry)
:let [next-jel (->> (dc/index-pull db {:index :avet
:selector [:db/id :journal-entry-line/client+account+location+date]
:start [:journal-entry-line/client+account+location+date
(:journal-entry-line/client+account+location+date jel)
(:db/id jel)]
})
(take-while (fn line-must-match-client-account-location [result]
(and
(= (take 3 (:journal-entry-line/client+account+location+date result))
(take 3 (:journal-entry-line/client+account+location+date jel)))
(not= (:db/id jel)
(:db/id result)))
))
first
:db/id)]
:when next-jel]
next-jel))
(for [jel (:journal-entry/line-items journal-entry)
next-jel (->> (dc/index-pull db {:index :avet
:selector [:db/id :journal-entry-line/client+account+location+date]
:start [:journal-entry-line/client+account+location+date
(:journal-entry-line/client+account+location+date jel)
(:db/id jel)]
})
(take-while (fn line-must-match-client-account-location [result]
(and
(= (take 3 (:journal-entry-line/client+account+location+date result))
(take 3 (:journal-entry-line/client+account+location+date jel)))
(not= (:db/id jel)
(:db/id result)))
))
(take 2))
:when next-jel]
(:db/id next-jel)))
(def extant-read '[:db/id :journal-entry/date :journal-entry/client {:journal-entry/line-items [:journal-entry-line/account :journal-entry-line/location :db/id :journal-entry-line/client+account+location+date]}])