progress on bugs

This commit is contained in:
Bryce Covert
2020-08-19 18:25:27 -07:00
parent 2716b6e2ba
commit a08c197159
8 changed files with 26 additions and 47 deletions

View File

@@ -150,7 +150,7 @@
conj
[]
transaction_ids)
transaction-rule (update (tr/get-by-id transaction_rule_id) :transaction-rule/description #(some-> % re-pattern))]
transaction-rule (update (tr/get-by-id transaction_rule_id) :transaction-rule/description #(some-> % rm/->pattern))]
(doseq [transaction transactions]
(when (not (rm/rule-applies? transaction transaction-rule))
(throw (ex-info "Transaction rule does not apply" {:validation-error "Transaction rule does not apply"

View File

@@ -13,6 +13,9 @@
[auto-ap.datomic.transaction-rules :as tr]
[clojure.tools.logging :as log]))
(defn ->pattern [x]
(. java.util.regex.Pattern (compile x java.util.regex.Pattern/CASE_INSENSITIVE)))
(defn rule-applies? [transaction {:keys [:transaction-rule/description
:transaction-rule/dom-gte :transaction-rule/dom-lte
:transaction-rule/amount-gte :transaction-rule/amount-lte
@@ -83,8 +86,7 @@
(recur rules)))
[])))
(defn ->pattern [x]
(. java.util.regex.Pattern (compile x java.util.regex.Pattern/CASE_INSENSITIVE)))
(defn group-rules-by-priority [rules]
(->> rules