From 7af6873cfcc3d151f8ddeca311405e623c40e6a6 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 5 May 2020 07:06:10 -0700 Subject: [PATCH] account rollout bug fixes. --- src/clj/auto_ap/routes/invoices.clj | 13 +++++++++++-- src/clj/auto_ap/yodlee/import.clj | 2 +- src/cljs/auto_ap/views/pages/unpaid_invoices.cljs | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/clj/auto_ap/routes/invoices.clj b/src/clj/auto_ap/routes/invoices.clj index 6a1d078e..fe73231d 100644 --- a/src/clj/auto_ap/routes/invoices.clj +++ b/src/clj/auto_ap/routes/invoices.clj @@ -262,7 +262,8 @@ (POST "/batch-upload" {{:keys [data]} :edn-params user :identity} (assert-admin user) - (let [columns [:status :raw-date :description-original :high-level-category nil nil :amount nil nil nil nil nil :bank-account-code :client-code] + (try + (let [columns [:status :raw-date :description-original :high-level-category nil nil :amount nil nil nil nil nil :bank-account-code :client-code] all-clients (d-clients/get-all) all-bank-accounts (mapcat :client/bank-accounts all-clients) all-clients (merge (by :client/code all-clients) (by :client/name all-clients)) @@ -290,7 +291,15 @@ {:status 200 :body (pr-str {:imported (count raw-transactions) :errors (map #(dissoc % :date) error-rows)}) - :headers {"Content-Type" "application/edn"}}))) + :headers {"Content-Type" "application/edn"}}) + (catch Exception e + (println (.toString e)) + {:status 500 + :body (pr-str {:message (.getMessage e) + :error (.toString e) + :data (ex-data e)}) + :headers {"Content-Type" "application/edn"}})) + )) (context "/invoices" [] (POST "/upload" diff --git a/src/clj/auto_ap/yodlee/import.clj b/src/clj/auto_ap/yodlee/import.clj index d01ce87e..5bc045bc 100644 --- a/src/clj/auto_ap/yodlee/import.clj +++ b/src/clj/auto_ap/yodlee/import.clj @@ -109,7 +109,7 @@ :location (when check "A") :accounts (when check - [#:transaction-account {:account (:db/id (a/get-account-by-numeric-code-and-sets 2110 ["default"])) + [#:transaction-account {:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"])) :location "A" :amount (Math/abs (double amount))}])} diff --git a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs index 458e661d..fb914bf2 100644 --- a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs +++ b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs @@ -615,7 +615,7 @@ current-client @(re-frame/subscribe [::subs/client])] [:div #_[:h1.title (str (str/capitalize (or status "all")) " invoices")] - (when (= status "unpaid") + (when (= status :unpaid) [pay-button {:print-checks-shown? print-checks-shown? :checked-invoices checked :print-checks-loading? print-checks-loading?}]) [table/invoice-table {:id :unpaid :invoice-page (re-frame/subscribe [::invoice-page]) @@ -626,7 +626,7 @@ (re-frame/dispatch [::unvoid-invoice which])) :on-void-invoice (fn [which] (re-frame/dispatch [::void-invoice which])) - :check-boxes (= status "unpaid") + :check-boxes (= status :unpaid) :checked checked :on-check-changed (fn [which invoice] (re-frame/dispatch [::toggle-check which invoice]))