minor tweak for parsing.

This commit is contained in:
Bryce Covert
2022-12-12 13:02:23 -08:00
parent 387a153be5
commit 89c32a95fa
2 changed files with 23 additions and 5 deletions

View File

@@ -99,6 +99,12 @@
{:db/id invoice-id
:invoice/total target-total})
(when (and (not (dollars= 0.0 target-total))
(= :invoice-status/voided (:db/ident (:invoice/status invoice))))
{:db/id invoice-id
:invoice/total target-total
:invoice/status :invoice-status/paid})
(when new-account?
{:db/id invoice-id
:invoice/expense-accounts invoice-expense-account-id})

View File

@@ -170,11 +170,23 @@
[:button.button.is-medium {:on-click (fn [e]
(.preventDefault e)
(on-change
(cond->> (str/split @text-form #"\n")
@include-headers (drop 1)
true (mapv #(->> (str/split % "\t")
(map (fn [[_ k] v] [k v]) headings)
(into {}))))))}
(persistent!
(reduce
(fn [acc row]
(let [values (str/split row "\t")]
(conj! acc
(loop [row (transient {})
[[_ heading] & headings] headings
[v & values] values]
(if heading
(recur
(assoc! row heading v)
headings
values)
(persistent! row))))))
(transient [])
(cond->> (str/split @text-form #"\n")
@include-headers (drop 1))))))}
"Parse"]
])]])))