minor tweak for parsing.
This commit is contained in:
@@ -99,6 +99,12 @@
|
|||||||
{:db/id invoice-id
|
{:db/id invoice-id
|
||||||
:invoice/total target-total})
|
: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?
|
(when new-account?
|
||||||
{:db/id invoice-id
|
{:db/id invoice-id
|
||||||
:invoice/expense-accounts invoice-expense-account-id})
|
:invoice/expense-accounts invoice-expense-account-id})
|
||||||
|
|||||||
@@ -170,11 +170,23 @@
|
|||||||
[:button.button.is-medium {:on-click (fn [e]
|
[:button.button.is-medium {:on-click (fn [e]
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
(on-change
|
(on-change
|
||||||
(cond->> (str/split @text-form #"\n")
|
(persistent!
|
||||||
@include-headers (drop 1)
|
(reduce
|
||||||
true (mapv #(->> (str/split % "\t")
|
(fn [acc row]
|
||||||
(map (fn [[_ k] v] [k v]) headings)
|
(let [values (str/split row "\t")]
|
||||||
(into {}))))))}
|
(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"]
|
"Parse"]
|
||||||
])]])))
|
])]])))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user