simplify sorting
This commit is contained in:
@@ -601,7 +601,8 @@
|
||||
(:sort args)))
|
||||
|
||||
(defn apply-sort-3 [args results]
|
||||
(let [sort-bys (conj (:sort args)
|
||||
|
||||
(let [sort-bys (conj (into [] (:sort args))
|
||||
{:sort-key "default" :asc (if (contains? args :default-asc?)
|
||||
(:default-asc? args)
|
||||
true)})
|
||||
@@ -609,16 +610,17 @@
|
||||
comparator (fn [xs ys]
|
||||
(reduce
|
||||
(fn [_ i]
|
||||
|
||||
(let [comparison (if (:asc (nth sort-bys i))
|
||||
(compare (nth xs i) (nth ys i))
|
||||
(compare (nth ys i) (nth xs i)))]
|
||||
|
||||
|
||||
(if (not= 0 comparison)
|
||||
(reduced comparison)
|
||||
0)))
|
||||
0
|
||||
(range length)))]
|
||||
(sort comparator results )))
|
||||
(sort comparator results)))
|
||||
|
||||
(defn apply-pagination-raw [args results]
|
||||
{:entries (->> results
|
||||
|
||||
Reference in New Issue
Block a user