tons of bug fixes

This commit is contained in:
Bryce Covert
2020-07-08 21:44:11 -07:00
parent 86f51f93e4
commit d120b7e810
18 changed files with 442 additions and 156 deletions

View File

@@ -224,8 +224,6 @@
txes (transduce
(comp
(mapcat (fn parse-map [[account account-name override-name _ type]]
(let [code (some-> account
not-empty
@@ -277,3 +275,28 @@
[{:db/id [:client/code client-code]
:client/signature-file (str "https://s3.amazonaws.com/integreat-signature-images/" filename)}]))
(defn fix-transactions-without-locations [client-code location]
(->>
(d/query {:query {:find ['(pull ?e [*])]
:in ['$ '?client-code]
:where ['[?e :transaction/accounts ?ta]
'[?e :transaction/matched-rule]
'[?e :transaction/approval-status :transaction-approval-status/approved]
'(not [?ta :transaction-account/location])
'[?e :transaction/client ?c]
'[?c :client/code ?client-code]
]}
:args [(d/db (d/connect uri)) client-code]})
(mapcat
(fn [[{:transaction/keys [accounts]}]]
(mapv
(fn [a]
{:db/id (:db/id a)
:transaction-account/location location}
)
accounts)
)
)
vec))