Using ions for dollar matching

This commit is contained in:
2023-03-27 10:58:18 -07:00
parent e3fbc50e6a
commit 952aa38951
5 changed files with 16 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
(ns iol-ion.query)
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn dollars-0? [amt]
(< -0.001 amt 0.001))
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn dollars= [amt1 amt2]
(dollars-0? (- amt1 amt2) ))

View File

@@ -3,5 +3,8 @@
iol-ion.tx/reset-rels
iol-ion.tx/upsert-ledger
iol-ion.tx/min-by
iol-ion.tx/propose-invoice]
iol-ion.tx/propose-invoice
iol-ion.query/dollars=
iol-ion.query/dollars-0?]
:app-name "iol-cloud"}

View File

@@ -117,7 +117,7 @@
(:amount args)
(merge-query {:query {:in ['?amount]
:where ['[?e :payment/amount ?transaction-amount]
'[(auto-ap.utils/dollars= ?transaction-amount ?amount)]]}
'[(iol-ion.query/dollars= ?transaction-amount ?amount)]]}
:args [(:amount args)]})

View File

@@ -67,7 +67,7 @@
(:total args)
(merge-query {:query {:in ['?total]
:where ['[?e :expected-deposit/total ?expected-deposit-total]
'[(auto-ap.utils/dollars= ?expected-deposit-total ?total)]]}
'[(iol-ion.query/dollars= ?expected-deposit-total ?total)]]}
:args [(:total args)]})

View File

@@ -189,7 +189,7 @@
(:total args)
(merge-query {:query {:in ['?total]
:where ['[?e :sales-order/total ?sales-order-total]
'[(auto-ap.utils/dollars= ?sales-order-total ?total)]]}
'[(iol-ion.query/dollars= ?sales-order-total ?total)]]}
:args [(:total args)]})
true