several fixes.
This commit is contained in:
@@ -36,19 +36,22 @@
|
||||
(defmethod parse-csv :sysco
|
||||
[rows]
|
||||
(println "Importing Sysco")
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
(map (fn [[invoice-number invoice-date _ amount :as row]]
|
||||
{:vendor-code "Sysco"
|
||||
:customer-identifier nil
|
||||
:invoice-number invoice-number
|
||||
:date (parse-date-fallover invoice-date ["M/d/yyyy"])
|
||||
:total (str/replace amount #"[,\$]" "")
|
||||
:text (str/join " " row)
|
||||
:full-text (str/join " " row)})))
|
||||
conj
|
||||
[]
|
||||
rows))
|
||||
(let [header (first rows)]
|
||||
(transduce
|
||||
(comp (drop 1)
|
||||
(map (fn [row]
|
||||
(into {} (map vector header row))))
|
||||
(map (fn [row]
|
||||
{:vendor-code "Sysco"
|
||||
:customer-identifier nil
|
||||
:invoice-number (get row "Inv #")
|
||||
:date (parse-date-fallover (get row "Invoice Date") ["M/d/yyyy"])
|
||||
:total (str/replace (get row "Orig Amt") #"[,\$]" "")
|
||||
:text (str/join " " (vals row))
|
||||
:full-text (str/join " " (vals row))})))
|
||||
conj
|
||||
[]
|
||||
rows)))
|
||||
|
||||
(defmethod parse-csv :mama-lus
|
||||
[rows]
|
||||
|
||||
Reference in New Issue
Block a user