replying to emails
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
[ring.middleware.reload :refer [wrap-reload]]
|
||||
[ring.middleware.edn :refer [wrap-edn-params]]
|
||||
[clojure.java.jdbc :as j]
|
||||
[clj-fuzzy.metrics :as m]
|
||||
[clj-http.client :as http]
|
||||
[clj-time.core :as time]
|
||||
[config.core :refer [env]]
|
||||
@@ -27,14 +26,7 @@
|
||||
[auto-ap.db.vendors :as vendors]
|
||||
[amazonica.core :refer [defcredential]]
|
||||
[amazonica.aws.simpleemail :as ses]))
|
||||
(defn best-match [companies company-identifier]
|
||||
(->> companies
|
||||
(map (fn [company]
|
||||
[company (apply min (map #(m/jaccard (.toLowerCase company-identifier) %) (:matches company)))]))
|
||||
(filter #(< (second %) 0.25))
|
||||
(sort-by second)
|
||||
|
||||
ffirst))
|
||||
|
||||
|
||||
(def google-client-id "264081895820-0nndcfo3pbtqf30sro82vgq5r27h8736.apps.googleusercontent.com")
|
||||
(def google-client-secret "OC-WemHurPXYpuIw5cT-B90g")
|
||||
@@ -168,12 +160,12 @@
|
||||
(for [{:keys [total date invoice-number customer-identifier vendor] :as row}
|
||||
(parse/parse-file (.getPath tempfile) filename)]
|
||||
(assoc row
|
||||
:company (:name (best-match companies customer-identifier))
|
||||
:company (:name (parse/best-match companies customer-identifier))
|
||||
|
||||
:imported false
|
||||
:potential-duplicate (boolean (seq (filter #(and (= vendor (:vendor %))
|
||||
(= invoice-number (:invoice-number %)))
|
||||
existing-invoices)))
|
||||
(= invoice-number (:invoice-number %)))
|
||||
existing-invoices)))
|
||||
)))
|
||||
{:status 200
|
||||
:body (pr-str (invoices/get-pending ((:query-params params ) "company")))
|
||||
|
||||
Reference in New Issue
Block a user