make import more forgiving.
This commit is contained in:
@@ -339,14 +339,20 @@
|
||||
:error :import-batch/error
|
||||
:not-ready :import-batch/not-ready) inc))
|
||||
(when (= :import action)
|
||||
(alog/info ::upserting-transaction :transaction [:upsert-transaction (transaction->txs transaction bank-account rule-applying-function)])
|
||||
(let [result (audit-transact [[:upsert-transaction (transaction->txs transaction bank-account rule-applying-function)]
|
||||
{:db/id import-id
|
||||
:import-batch/entry (:db/id transaction)}]
|
||||
{:user/name user
|
||||
:user/role ":admin"})]
|
||||
(doseq [[_ n] (:tempids result)]
|
||||
(solr/touch-with-ledger n))))))
|
||||
(try
|
||||
(let [result (audit-transact [[:upsert-transaction (transaction->txs transaction bank-account rule-applying-function)]
|
||||
{:db/id import-id
|
||||
:import-batch/entry (:db/id transaction)}]
|
||||
{:user/name user
|
||||
:user/role ":admin"})]
|
||||
(doseq [[_ n] (:tempids result)]
|
||||
(solr/touch-with-ledger n)))
|
||||
(catch Exception e
|
||||
(swap! stats
|
||||
#(update % :import-batch/error inc))
|
||||
(alog/error ::invalid-transaction
|
||||
:hint "It may be that the same bank account is linked twice"
|
||||
:error e))))))
|
||||
|
||||
(get-stats [_]
|
||||
@stats)
|
||||
|
||||
Reference in New Issue
Block a user