This commit is contained in:
Bryce Covert
2019-04-11 15:13:53 -07:00
parent 5d93e3a5a3
commit e217bad88e

View File

@@ -28,7 +28,6 @@
(= (:asc args) false) (reverse))) (= (:asc args) false) (reverse)))
(defn apply-sort-2 [args results ] (defn apply-sort-2 [args results ]
(let [comparator (if (= (:asc args) false) (let [comparator (if (= (:asc args) false)
(fn [x y] (compare y x)) (fn [x y] (compare y x))
(fn [x y] (compare x y)))] (fn [x y] (compare x y)))]
@@ -50,14 +49,13 @@
(:sort-by args) (add-sorter-field {"client" ['[?e :transaction/client ?c] (:sort-by args) (add-sorter-field {"client" ['[?e :transaction/client ?c]
'[?c :client/name ?sorter]] '[?c :client/name ?sorter]]
"account" #_['[(get-else $ ?e :transaction/account 0) ?sorter]] "account" ['[?e :transaction/date]
['[?e :transaction/date] '(or-join [?e ?sorter]
'(or-join [?e ?sorter] (and [?e :transaction/account ?c]
(and [?e :transaction/account ?c] [?c :account/name ?sorter])
[?c :account/name ?sorter]) (and
(and (not [?e :transaction/account])
(not [?e :transaction/account]) [(ground "") ?sorter]))]
[(ground "") ?sorter]))]
"description-original" ['[?e :transaction/description-original ?sorter]] "description-original" ['[?e :transaction/description-original ?sorter]]
"date" ['[?e :transaction/date ?sorter]] "date" ['[?e :transaction/date ?sorter]]
"amount" ['[?e :transaction/amount ?sorter]] "amount" ['[?e :transaction/amount ?sorter]]