several fixes.

This commit is contained in:
Bryce Covert
2019-04-24 21:29:38 -07:00
parent b5ca106260
commit 452e663049
12 changed files with 82 additions and 49 deletions

View File

@@ -8,13 +8,13 @@
(defn sort-fn [sort-by]
(cond
(= "client" sort-by)
#(-> % :transaction/client :client/name)
#(-> % :journal-entry/client :client/name)
(= "account" sort-by)
#(vector (-> % :transaction/account :account/name) (-> % :db/id))
(= "vendor" sort-by)
#(-> % :journal-entry/vendor :vendor/name)
:else
(keyword "transaction" sort-by)))
(keyword "journal-entry" sort-by)))
(defn raw-graphql-ids [db args]
@@ -26,6 +26,7 @@
(:sort-by args) (add-sorter-field {"client" ['[?e :journal-entry/client ?c]
'[?c :client/name ?sorter]]
"date" ['[?e :journal-entry/date ?sorter]]
"vendor" ['[?e :journal-entry/vendor ?sorter]]
"amount" ['[?e :journal-entry/amount ?sorter]]}
args)
@@ -75,7 +76,6 @@
true
(merge-query {:query {:find ['?e] :where ['[?e :journal-entry/date]]}}))]
(println query)
(cond->> query
true (d/query)
(:sort-by args) (apply-sort-2 args)