Migrates back to datomic on-prem
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
:refer [add-sorter-fields-2
|
||||
apply-pagination
|
||||
apply-sort-3
|
||||
pull-id
|
||||
conn
|
||||
merge-query
|
||||
pull-id
|
||||
pull-many
|
||||
visible-clients
|
||||
conn]]
|
||||
[iol-ion.query]
|
||||
query2
|
||||
visible-clients]]
|
||||
[clj-time.coerce :as c]
|
||||
[clj-time.core :as time]
|
||||
[clojure.set :as set]
|
||||
[datomic.client.api :as dc]
|
||||
[com.brunobonacci.mulog :as mu]
|
||||
))
|
||||
[datomic.api :as dc]
|
||||
[iol-ion.query]))
|
||||
|
||||
(defn <-datomic [result]
|
||||
(-> result
|
||||
@@ -115,8 +115,7 @@
|
||||
:stats (:query-stats (dc/q (assoc query :query-stats true)))
|
||||
:q (str query))
|
||||
|
||||
(cond->> query
|
||||
true (dc/q)
|
||||
(cond->> (query2 query)
|
||||
true (apply-sort-3 (assoc args :default-asc? false))
|
||||
true (apply-pagination args))))
|
||||
|
||||
@@ -132,14 +131,14 @@
|
||||
(defn summarize-orders [ids]
|
||||
|
||||
(let [[total tax] (->>
|
||||
(dc/q {:query {:find ['(sum ?t) '(sum ?tax)]
|
||||
:with ['?id]
|
||||
:in ['$ '[?id ...]]
|
||||
:where ['[?id :sales-order/total ?t]
|
||||
'[?id :sales-order/tax ?tax]]}
|
||||
:args [(dc/db conn)
|
||||
ids]})
|
||||
first)]
|
||||
(dc/q {:find ['(sum ?t) '(sum ?tax)]
|
||||
:with ['?id]
|
||||
:in ['$ '[?id ...]]
|
||||
:where ['[?id :sales-order/total ?t]
|
||||
'[?id :sales-order/tax ?tax]]}
|
||||
(dc/db conn)
|
||||
ids)
|
||||
first)]
|
||||
{:total total
|
||||
:tax tax}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user