Most parts of staging ought to work

This commit is contained in:
Bryce Covert
2020-12-26 14:10:51 -08:00
parent a46b58fe00
commit 3b39a6fa0a
7 changed files with 340 additions and 158 deletions

View File

@@ -54,7 +54,7 @@
(defn expense-account->entity [{:keys [id account_id amount location]}]
(remove-nils #:invoice-expense-account {:amount (Double/parseDouble amount)
(remove-nils #:invoice-expense-account {:amount amount
:db/id id
:account account_id
:location location}))
@@ -160,7 +160,7 @@
:invoice/client (:db/id (:invoice/client invoice))}))
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number})))
expense-account-total (reduce + 0 (map (fn [x] (Double/parseDouble (:amount x))) expense_accounts))
expense-account-total (reduce + 0 (map (fn [x] (:amount x)) expense_accounts))
_ (when-not (dollars= total expense-account-total)
(let [error (str "Expense account total (" expense-account-total ") does not equal invoice total (" total ")")]
(throw (ex-info error {:validation-error error}))))

View File

@@ -119,7 +119,7 @@
(defn transaction-account->entity [{:keys [id account_id amount location]}]
(remove-nils #:transaction-account {:amount (Double/parseDouble amount)
(remove-nils #:transaction-account {:amount amount
:db/id id
:account account_id
:location location}))
@@ -163,7 +163,7 @@
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
_ (assert-valid-expense-accounts accounts)
deleted (deleted-accounts existing-transaction accounts)
account-total (reduce + 0 (map (fn [x] (Double/parseDouble (:amount x))) accounts))
account-total (reduce + 0 (map (fn [x] (:amount x)) accounts))
missing-locations (seq (set/difference
(->> accounts
(map :location)