minor tweak for parsing.
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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"]
|
||||
])]])))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user