Made ledger repair fast and work
This commit is contained in:
@@ -196,8 +196,7 @@
|
|||||||
(= b bank-account))))
|
(= b bank-account))))
|
||||||
(map :journal-entry-line/running-balance)
|
(map :journal-entry-line/running-balance)
|
||||||
(first))
|
(first))
|
||||||
0.0)})})))
|
0.0)})}))))
|
||||||
)
|
|
||||||
|
|
||||||
(defn get-client [context _ _]
|
(defn get-client [context _ _]
|
||||||
(->graphql
|
(->graphql
|
||||||
|
|||||||
@@ -193,9 +193,13 @@
|
|||||||
(mapv #(entity-change->ledger (dc/db conn) [:invoice %])))
|
(mapv #(entity-change->ledger (dc/db conn) [:invoice %])))
|
||||||
repairs (vec (concat txes-missing-ledger-entries invoices-missing-ledger-entries))]
|
repairs (vec (concat txes-missing-ledger-entries invoices-missing-ledger-entries))]
|
||||||
(when (seq repairs)
|
(when (seq repairs)
|
||||||
(log/info (take 3 repairs))
|
(mu/log ::ledger-repairs-needed
|
||||||
(log/warn "repairing " (count txes-missing-ledger-entries) " missing transactions, " (count invoices-missing-ledger-entries) " missing invoices that were missing ledger entries")
|
:sample (take 3 repairs)
|
||||||
(dc/transact conn {:tx-data repairs})))))
|
:transaction-count (count txes-missing-ledger-entries)
|
||||||
|
:invoice-count (count invoices-missing-ledger-entries))
|
||||||
|
(dc/transact conn {:tx-data (map (fn [repair]
|
||||||
|
`(upsert-ledger ~repair))
|
||||||
|
repairs) })))))
|
||||||
|
|
||||||
|
|
||||||
(defn touch-transaction [e]
|
(defn touch-transaction [e]
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
|
|
||||||
(defn -main [& _]
|
(defn -main [& _]
|
||||||
(let [job (System/getenv "INTEGREAT_JOB")]
|
(let [job (System/getenv "INTEGREAT_JOB")]
|
||||||
|
(println "JOB is" job)
|
||||||
(cond (= job "square-import-job")
|
(cond (= job "square-import-job")
|
||||||
(job-square/-main)
|
(job-square/-main)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user