Updates for events.
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
(ns auto-ap.ledger
|
||||
(:require [datomic.api :as d]
|
||||
[yang.scheduler :as scheduler]
|
||||
[mount.core :as mount]
|
||||
[auto-ap.datomic.accounts :as a]
|
||||
[auto-ap.datomic :refer [uri remove-nils conn]]
|
||||
[clojure.spec.alpha :as s]
|
||||
[auto-ap.utils :refer [dollars-0? dollars=] ]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.logging :refer [info-event]]
|
||||
[unilog.context :as lc]))
|
||||
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn remove-nils]]
|
||||
[auto-ap.logging :refer [info-event]]
|
||||
[auto-ap.utils :refer [dollars-0? dollars=]]
|
||||
[clojure.tools.logging :as log]
|
||||
[com.unbounce.dogstatsd.core :as statsd]
|
||||
[datomic.api :as d]
|
||||
[mount.core :as mount]
|
||||
[unilog.context :as lc]
|
||||
[yang.scheduler :as scheduler]))
|
||||
|
||||
(defn datums->impacted-entity [db [e changes]]
|
||||
(let [entity (d/pull db '[* {:invoice/_expense-accounts [:db/id] :transaction/_accounts [:db/id]}] e)
|
||||
@@ -372,6 +371,10 @@
|
||||
|
||||
(defn touch-broken-ledger []
|
||||
(lc/with-context {:source "touch-broken-ledger"}
|
||||
(statsd/event {:title "Reconciling Ledger"
|
||||
:text "This process looks for unbalance ledger entries, or missing ledger entries"
|
||||
:priority :low}
|
||||
nil)
|
||||
(try
|
||||
(log/info "Attempting to fix transactions that are in the ledger but are wrong")
|
||||
(let [mismatched-ts (mismatched-transactions)]
|
||||
@@ -403,6 +406,10 @@
|
||||
(touch-invoice m)))))
|
||||
|
||||
(log/info "Finished fixing invoices that are in the ledger but are wrong")
|
||||
(statsd/event {:title "Finished Reconciling Ledger"
|
||||
:text "This process looks for unbalance ledger entries, or missing ledger entries"
|
||||
:priority :low}
|
||||
nil)
|
||||
(catch Exception e
|
||||
(log/error e)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user