tons of bug fixes
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user