fixes a bug with manual import
This commit is contained in:
@@ -266,13 +266,13 @@
|
||||
(defn get-existing [bank-account]
|
||||
(log/info "looking up bank account data for" bank-account)
|
||||
(into {}
|
||||
(dc/q {:query {:find ['?tid '?as2]
|
||||
:in ['$ '?ba]
|
||||
:where ['[?e :transaction/bank-account ?ba]
|
||||
'[?e :transaction/id ?tid]
|
||||
'[?e :transaction/approval-status ?as]
|
||||
'[?as :db/ident ?as2]]}
|
||||
:args [(dc/db conn) bank-account]})))
|
||||
(dc/q '[:find ?tid ?as2
|
||||
:in $ ?ba
|
||||
:where [?e :transaction/bank-account ?ba]
|
||||
[?e :transaction/id ?tid]
|
||||
[?e :transaction/approval-status ?as]
|
||||
[?as :db/ident ?as2]]
|
||||
(dc/db conn) bank-account)))
|
||||
|
||||
(defprotocol ImportBatch
|
||||
(import-transaction! [this transaction])
|
||||
|
||||
@@ -533,3 +533,21 @@
|
||||
[(str id) client-code "synthetic" v d a-2 (or a-2-location client-location) amount 0]]]
|
||||
a)
|
||||
:separator \tab))))
|
||||
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn sample-manual-yodlee
|
||||
([client-code]
|
||||
(sample-ledger-import client-code 10))
|
||||
([client-code n]
|
||||
(let [bank-accounts (map first (d/q '[:find ?bac :in $ ?c :where [?c :client/bank-accounts ?b] [?b :bank-account/code ?bac]] (dc/db conn) [:client/code client-code]))]
|
||||
(clojure.data.csv/write-csv
|
||||
*out*
|
||||
(for [n (range n)
|
||||
:let [amount (rand-int 2000)
|
||||
d (-> (t/now)
|
||||
(t/minus (t/days (rand-int 60)))
|
||||
(atime/unparse atime/normal-date))
|
||||
id (rand-int 100000)]]
|
||||
["posted" d (str "Random Description - " id) "Travel" nil nil (- amount) nil nil nil nil nil (rand-nth bank-accounts) client-code])
|
||||
:separator \tab))))
|
||||
|
||||
Reference in New Issue
Block a user