implementing sorting for checks.

This commit is contained in:
Bryce Covert
2019-05-04 12:25:55 -07:00
parent f8d8872131
commit 976d37d641
5 changed files with 120 additions and 86 deletions

View File

@@ -320,11 +320,8 @@
(defn get-payment-page [context args value]
(let [args (assoc args :id (:id context))
payments (map
->graphql
(d-checks/get-graphql (<-graphql args)))
checks-count (d-checks/count-graphql (<-graphql args))]
[{:payments payments
[payments checks-count] (d-checks/get-graphql (<-graphql args))]
[{:payments (map ->graphql payments)
:total checks-count
:count (count payments)
:start (:start args 0)
@@ -332,12 +329,12 @@
(defn get-potential-payments [context args value]
(let [transaction (d-transactions/get-by-id (:transaction_id args))
_ (assert-can-see-client (:id context) (:transaction/client transaction))]
(map ->graphql
(d-checks/get-graphql {:client-id (:db/id (:transaction/client transaction))
:bank-account-id (:db/id (:transaction/bank-account transaction))
:amount (- (:transaction/amount transaction))
:status :payment-status/pending}))))
_ (assert-can-see-client (:id context) (:transaction/client transaction))
[payments payments-count] (d-checks/get-graphql {:client-id (:db/id (:transaction/client transaction))
:bank-account-id (:db/id (:transaction/bank-account transaction))
:amount (- (:transaction/amount transaction))
:status :payment-status/pending})]
(map ->graphql payments)))
(defn add-handwritten-check [context args value]
(let [invoices (d-invoices/get-multi (map :invoice_id (:invoice_payments args)))