Merge branch 'master' into fix-stuff

This commit is contained in:
Bryce Covert
2020-12-21 20:05:54 -08:00
4 changed files with 29 additions and 20 deletions

View File

@@ -4,4 +4,4 @@ RUN apk add poppler
RUN apk add poppler-utils RUN apk add poppler-utils
COPY target/auto-ap.jar /usr/local/ COPY target/auto-ap.jar /usr/local/
COPY config /usr/local/config/ COPY config /usr/local/config/
CMD java -Dlogback.configurationFile=logback-prod.xml -jar /usr/local/auto-ap.jar CMD java -Dlogback.configurationFile=logback-prod.xml -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.local.only=false -jar /usr/local/auto-ap.jar

View File

@@ -14,28 +14,19 @@
(let [query (cond-> {:query {:find [] (let [query (cond-> {:query {:find []
:in ['$ ] :in ['$ ]
:where ['[?e :journal-entry/date ?sort-default]]} :where []}
:args [db]} :args [db]}
(:sort args) (add-sorter-fields {"client" ['[?e :journal-entry/client ?c]
'[?c :client/name ?sort-client]]
"date" ['[?e :journal-entry/date ?sort-date]]
"vendor" ['[?e :journal-entry/vendor ?sort-vendor]]
"amount" ['[?e :journal-entry/amount ?sort-amount]]
"external-id" ['[?e :journal-entry/external-id ?sort-external-id]]
"source" ['[?e :journal-entry/source ?sort-source]]}
args)
(limited-clients (:id args))
(merge-query {:query {:in ['[?xx ...]]
:where ['[?e :journal-entry/client ?xx]]}
:args [(set (map :db/id (limited-clients (:id args))))]})
(:client-id args) (:client-id args)
(merge-query {:query {:in ['?client-id] (merge-query {:query {:in ['?client-id]
:where ['[?e :journal-entry/client ?client-id]]} :where ['[?e :journal-entry/client ?client-id]]}
:args [(:client-id args)]}) :args [(:client-id args)]})
(:only-external args) (:only-external args)
(merge-query {:query {:where ['(not [?e :journal-entry/original-entity ])]}}) (merge-query {:query {:where ['(not [?e :journal-entry/original-entity ])]}})
@@ -113,10 +104,23 @@
:where ['[?e :journal-entry/line-items ?li] :where ['[?e :journal-entry/line-items ?li]
'[?li :journal-entry-line/location ?location]]} '[?li :journal-entry-line/location ?location]]}
:args [(:location args)]}) :args [(:location args)]})
(limited-clients (:id args))
(merge-query {:query {:in ['[?xx ...]]
:where ['[?e :journal-entry/client ?xx]]}
:args [(set (map :db/id (limited-clients (:id args))))]})
(:sort args) (add-sorter-fields {"client" ['[?e :journal-entry/client ?c]
'[?c :client/name ?sort-client]]
"date" ['[?e :journal-entry/date ?sort-date]]
"vendor" ['[?e :journal-entry/vendor ?v]
'[?v :vendor/name ?sort-vendor]]
"amount" ['[?e :journal-entry/amount ?sort-amount]]
"external-id" ['[?e :journal-entry/external-id ?sort-external-id]]
"source" ['[?e :journal-entry/source ?sort-source]]}
args)
true true
(merge-query {:query {:find ['?sort-default '?e] :where ['[?e :journal-entry/date ?sort-default]]}}))] (merge-query {:query {:find ['?sort-default '?e] :where ['[?e :journal-entry/date ?sort-default]]}}))]
(->> (doto query println) (->> (doto query log/info)
(d/query) (d/query)
(apply-sort-3 (update args :sort conj {:sort-key "default-2" :asc true})) (apply-sort-3 (update args :sort conj {:sort-key "default-2" :asc true}))

View File

@@ -38,7 +38,7 @@
)) ))
) )
journal-entries)] journal-entries)]
(result->page journal-entries journal-entries-count :journal_entries args))) (result->page journal-entries journal-entries-count :journal_entries (:filters args))))
;; TODO a better way to do this might be to accumulate ALL credits and ALL debits, and then just do for credits: balance = credits - debits. and for debits balance = debits - credits ;; TODO a better way to do this might be to accumulate ALL credits and ALL debits, and then just do for credits: balance = credits - debits. and for debits balance = debits - credits
(defn credit-account? [account] (defn credit-account? [account]

View File

@@ -17,8 +17,13 @@
(def other-config (def other-config
(if (:yodlee-proxy-host env) (if (:yodlee-proxy-host env)
{:proxy-host (:yodlee-proxy-host env) {:proxy-host (:yodlee-proxy-host env)
:proxy-port (:yodlee-proxy-port env)} :proxy-port (:yodlee-proxy-port env)
{})) :retry-handler (fn [ex try-count http-context]
(log/error "yodlee Error." ex)
false)}
{:retry-handler (fn [ex try-count http-context]
(log/error "yodlee Error." ex)
false)}))
(def base-headers {"Api-Version" "1.1" (def base-headers {"Api-Version" "1.1"
"loginName" (:yodlee-client-user-new env) "loginName" (:yodlee-client-user-new env)