fixes for staging, parsing

This commit is contained in:
Bryce Covert
2020-12-27 08:28:50 -08:00
parent c9f35cf7b4
commit 544a69432c
6 changed files with 29 additions and 26 deletions

View File

@@ -40,17 +40,15 @@
:serialize #(or (:ident %) (:db/ident %) %)}
:iso_date {:parse #(time/parse % time/iso-date)
:serialize #(time/unparse % time/iso-date)}
:money {:parse #(do
(log/info "parsing money...")
(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
:money {:parse #(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
(int? %)
(double %)
(int? %)
(double %)
:else
%))
:else
%)
:serialize #(cond (double? %)
(str %)
@@ -60,15 +58,17 @@
:else
%)
}
:percentage {:parse #(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
:percentage {:parse #(do
(log/info "value is" %)
(cond (and (string? %)
(not (str/blank? %)))
(Double/parseDouble %)
(int? %)
(str %)
(int? %)
(double %)
:else
%)
:else
%))
:serialize #(if (double? %)
(str %)
%)}}
@@ -681,14 +681,14 @@
:import_ledger_line_item {:fields {:account_identifier {:type 'String}
:location {:type 'String}
:debit {:type 'String}
:credit {:type 'String}}}
:debit {:type :money}
:credit {:type :money}}}
:import_ledger_entry {:fields {:source {:type 'String}
:external_id {:type 'String}
:client_code {:type 'String}
:date {:type 'String}
:vendor_name {:type 'String}
:amount {:type 'String}
:amount {:type :money}
:note {:type 'String}
:cleared_against {:type 'String}
:line_items {:type '(list :import_ledger_line_item)}}}
@@ -1309,7 +1309,7 @@
(do
(warn-event "validation error" {:validation-error v
:data (ex-data e)})
(throw (Exception. v))
(throw e)
#_{:errors [{:message v}]})
(do
(error-event "query error" {:error e})