simplify sorting

This commit is contained in:
Bryce
2024-04-10 14:48:47 -07:00
parent 1493b03ba3
commit 65be50cf9f
7 changed files with 104 additions and 81 deletions

View File

@@ -7,6 +7,7 @@
[auto-ap.datomic.accounts :as d-accounts]
[auto-ap.datomic.bank-accounts :as d-bank-accounts]
[auto-ap.datomic.invoices :as d-invoices]
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
[auto-ap.graphql.checks :as gq-checks :refer [base-payment
invoice-payments
print-checks-internal
@@ -236,6 +237,7 @@
query-params)
true
(merge-query {:query {:find ['?sort-default '?e]}})))]
(->> (observable-query query)
(apply-sort-3 (assoc query-params :default-asc? false))
(apply-pagination query-params))))
@@ -715,7 +717,6 @@
(map :invoice-id invoices))
(into {}))]
(every? (fn [%]
(println "TEST" (:amount %) (outstanding-balances (:invoice-id %)))
(not (does-amount-exceed-outstanding? (:amount %) (outstanding-balances (:invoice-id %)))))
invoices)))]]]
[:has-warning? :boolean]
@@ -1176,13 +1177,13 @@
(def key->handler
(apply-middleware-to-all-handlers
(->
{::route/all-page (-> (helper/page-route grid-page)
{::route/all-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status nil))
::route/paid-page (-> (helper/page-route grid-page)
::route/paid-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :invoice-status/paid))
::route/unpaid-page (-> (helper/page-route grid-page)
::route/unpaid-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :invoice-status/unpaid))
::route/voided-page (-> (helper/page-route grid-page)
::route/voided-page (-> (helper/page-route grid-page :parse-query-params? false)
(wrap-implied-route-param :status :invoice-status/voided))
::route/unvoid (-> unvoid-invoice
(wrap-entity [:route-params :db/id] default-read)
@@ -1211,10 +1212,11 @@
(mm/wrap-wizard pay-wizard)
(mm/wrap-decode-multi-form-state))
::route/table (helper/table-route grid-page)}
::route/table (helper/table-route grid-page :parse-query-params? false)}
(merge new-invoice-wizard/key->handler))
(fn [h]
(-> h
(wrap-copy-qp-pqp)
(wrap-status-from-source)
(wrap-apply-sort grid-page)
(wrap-merge-prior-hx)