Fixing export bugs with bad queries, improving performance.
This commit is contained in:
@@ -792,15 +792,18 @@
|
||||
|
||||
(defn apply-sort-3 [args results]
|
||||
(let [sort-bys (or (:sort args) [])
|
||||
length (count sort-bys)
|
||||
comparator (fn [xs ys]
|
||||
(or (->> (map vector sort-bys xs ys)
|
||||
(map (fn [[{:keys [asc]} x y]]
|
||||
(if asc
|
||||
(compare x y)
|
||||
(compare y x))))
|
||||
(drop-while #(= 0 %))
|
||||
first)
|
||||
0))]
|
||||
(reduce
|
||||
(fn [_ i]
|
||||
(let [comparison (if (:asc (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 )))
|
||||
|
||||
(defn apply-pagination [args results]
|
||||
|
||||
Reference in New Issue
Block a user