adding most simple balance sheet report.

This commit is contained in:
Bryce Covert
2019-04-11 22:46:30 -07:00
parent effbff04c6
commit 6ab9d89dfd
13 changed files with 298 additions and 74 deletions

View File

@@ -761,5 +761,28 @@
(defn add-sorter-field [q sort-map args]
(merge-query q
{:query {:find ['?sorter]
:where (sort-map
(:sort-by args)
(println "Warning, trying to sort by unsupported field" (:sort-by args)))}}))
(defn apply-sort [args sort-fn results ]
(cond->> results
sort-fn (sort-by sort-fn)
(= (:asc args) false) (reverse)))
(defn apply-sort-2 [args results ]
(let [comparator (if (= (:asc args) false)
(fn [x y] (compare y x))
(fn [x y] (compare x y)))]
(sort comparator results )))
(defn apply-pagination [args results]
{:ids (->> results
(drop (:start args 0))
(take (:count args 100))
(map last))
:count (count results)})