(cloud) tweaks for datomic cloud.

This commit is contained in:
2023-04-03 15:37:47 -07:00
parent 5293b7f3e6
commit a211a36c91
2 changed files with 15 additions and 14 deletions

View File

@@ -620,13 +620,6 @@
(->graphql users)))
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn categorize [x]
(cond (<= x 0) :due
(<= x 30 ) :due-30
(<= x 60 ) :due-60
:else :due-later))
(defn get-expense-account-stats [_ {:keys [client_id] } _]
(let [result (cond-> {:query {:find ['?account '?account-name '(sum ?amount)]
@@ -663,7 +656,15 @@
'[?i :invoice/due ?date]
'[(.toInstant ^java.util.Date ?date) ?d2]
'[(.between java.time.temporal.ChronoUnit/DAYS (java.time.Instant/now) ?d2 ) ?d3]
'[(auto-ap.graphql/categorize ?d3) ?name]]}})
'(or-join [?d3 ?name]
(and [(<= ?c 0)]
[(ground :due) ?name])
(and [(<= ?c 30)]
[(ground :due-30) ?name])
(and [(<= ?c 60)]
[(ground :due-30) ?name])
(and [(> ?c 60)]
[(ground :due-later) ?name]))]}})
true (dc/q))
result (group-by first result)]