Merge branch 'master' into port-datomic-cloud
This commit is contained in:
@@ -68,8 +68,8 @@
|
|||||||
(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
|
(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
|
||||||
(= "Y" break-flag)))
|
(= "Y" break-flag)))
|
||||||
(map (fn [[vendor location-hint invoice-number ship-date invoice-total ]]
|
(map (fn [[vendor location-hint invoice-number ship-date invoice-total ]]
|
||||||
(let [[matching-client similarity] (and location-hint
|
(let [matching-client (and location-hint
|
||||||
(parse/best-match clients location-hint 0.0))]
|
(parse/exact-match clients location-hint))]
|
||||||
{:invoice/vendor vendor
|
{:invoice/vendor vendor
|
||||||
:invoice/location (parse/best-location-match matching-client location-hint location-hint )
|
:invoice/location (parse/best-location-match matching-client location-hint location-hint )
|
||||||
:invoice/date (coerce/to-date (atime/parse ship-date atime/normal-date))
|
:invoice/date (coerce/to-date (atime/parse ship-date atime/normal-date))
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
first
|
first
|
||||||
:content
|
:content
|
||||||
first)
|
first)
|
||||||
[matching-client similarity] (and location-hint (parse/best-match clients location-hint 0.0))
|
matching-client (and location-hint (parse/exact-match clients location-hint))
|
||||||
|
|
||||||
]
|
]
|
||||||
(if matching-client
|
(if matching-client
|
||||||
|
|||||||
@@ -121,6 +121,16 @@
|
|||||||
first)]
|
first)]
|
||||||
(or fuzzy-match client-word-match))))
|
(or fuzzy-match client-word-match))))
|
||||||
|
|
||||||
|
(defn exact-match
|
||||||
|
([clients invoice-client-name]
|
||||||
|
(->> clients
|
||||||
|
(filter (fn [{:keys [:client/matches :client/name] :as client :or {matches []}}]
|
||||||
|
(seq
|
||||||
|
(filter (fn [m]
|
||||||
|
(= (.toLowerCase invoice-client-name) (.toLowerCase m)))
|
||||||
|
(conj matches name)))))
|
||||||
|
first)))
|
||||||
|
|
||||||
(defn best-location-match [client text full-text]
|
(defn best-location-match [client text full-text]
|
||||||
(or (->> client
|
(or (->> client
|
||||||
:client/location-matches
|
:client/location-matches
|
||||||
|
|||||||
Reference in New Issue
Block a user