brutal process of getting sorting to not mess stuff up.
This commit is contained in:
@@ -10,28 +10,11 @@
|
||||
#(-> % :transaction/client :client/name)
|
||||
|
||||
(= "account" sort-by)
|
||||
#(-> % :transaction/account :account/name)
|
||||
#(vector (-> % :transaction/account :account/name) (-> % :db/id))
|
||||
|
||||
:else
|
||||
(keyword "transaction" sort-by)))
|
||||
|
||||
;; TODO - unneeeded with merge-query
|
||||
(defn add-where [query & wheres]
|
||||
(reduce #(update-in %1 [:query :where] conj %2) query wheres))
|
||||
|
||||
;; TODO - unneeeded with merge-query
|
||||
(defn add-wheres [query wheres]
|
||||
(apply add-where query wheres))
|
||||
|
||||
|
||||
;; TODO - unneeeded with merge-query
|
||||
(defn add-arg [query name value where & rest]
|
||||
(let [query (-> query
|
||||
(update :args conj value)
|
||||
(update-in [:query :in] conj name)
|
||||
(update-in [:query :where] conj where))]
|
||||
(reduce #(update-in %1 [:query :where] conj %2) query rest)))
|
||||
|
||||
(defn add-sorter-field [q sort-map args]
|
||||
(merge-query q
|
||||
{:query {:find ['?sorter]
|
||||
@@ -68,12 +51,13 @@
|
||||
(:sort-by args) (add-sorter-field {"client" ['[?e :transaction/client ?c]
|
||||
'[?c :client/name ?sorter]]
|
||||
"account" #_['[(get-else $ ?e :transaction/account 0) ?sorter]]
|
||||
['(or (and [?e :transaction/account ?c]
|
||||
[?c :account/name ?sorter])
|
||||
(and
|
||||
[?e :transaction/client]
|
||||
[(ground 0) ?c]
|
||||
[(ground "") ?sorter]))]
|
||||
['[?e :transaction/date]
|
||||
'(or-join [?e ?sorter]
|
||||
(and [?e :transaction/account ?c]
|
||||
[?c :account/name ?sorter])
|
||||
(and
|
||||
(not [?e :transaction/account])
|
||||
[(ground "") ?sorter]))]
|
||||
"description-original" ['[?e :transaction/description-original ?sorter]]
|
||||
"date" ['[?e :transaction/date ?sorter]]
|
||||
"amount" ['[?e :transaction/amount ?sorter]]
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
(defn edit-transaction [context {{:keys [id account_id vendor_id] :as transaction} :transaction} value]
|
||||
(assert-can-see-client (:id context) (:db/id (d-transactions/get-by-id id)))
|
||||
(println transaction)
|
||||
@(d/transact (d/connect uri)
|
||||
[{:db/id id
|
||||
:transaction/vendor vendor_id
|
||||
|
||||
@@ -39,12 +39,7 @@
|
||||
:asc asc}
|
||||
"Vendor"]
|
||||
|
||||
[sorted-column {:on-sort opc
|
||||
:style {:width percentage-size :cursor "pointer"}
|
||||
:sort-key "description-original"
|
||||
:sort-by sort-by
|
||||
:asc asc}
|
||||
"Description"]
|
||||
|
||||
|
||||
|
||||
[sorted-column {:on-sort opc
|
||||
@@ -90,7 +85,7 @@
|
||||
[:td (if vendor
|
||||
(:name vendor)
|
||||
(str "Merchant '" "Hello" "'"))]
|
||||
[:td description-original]
|
||||
#_[:td description-original]
|
||||
[:td (date->str date) ]
|
||||
[:td.has-text-right (nf amount )]
|
||||
[:td (:name account)]
|
||||
|
||||
Reference in New Issue
Block a user