fixed common errors.
This commit is contained in:
@@ -79,40 +79,42 @@
|
||||
second
|
||||
(not-empty )
|
||||
Integer/parseInt)]
|
||||
(if num
|
||||
(->> (d/q '[:find ?n (pull ?i [:db/id :account/numeric-code :account/location])
|
||||
:in $ ?numeric-code
|
||||
:where [?i :account/numeric-code ?numeric-code]
|
||||
[?i :account/name ?n]]
|
||||
(d/db conn)
|
||||
num)
|
||||
(map (fn [[n a]]
|
||||
{:name (str (:account/numeric-code a) " - " n)
|
||||
:id (:db/id a)
|
||||
:location (:account/location a)})))
|
||||
(if query
|
||||
(if num
|
||||
(->> (d/q '[:find ?n (pull ?i [:db/id :account/numeric-code :account/location])
|
||||
:in $ ?numeric-code
|
||||
:where [?i :account/numeric-code ?numeric-code]
|
||||
[?i :account/name ?n]]
|
||||
(d/db conn)
|
||||
num)
|
||||
(map (fn [[n a]]
|
||||
{:name (str (:account/numeric-code a) " - " n)
|
||||
:id (:db/id a)
|
||||
:location (:account/location a)})))
|
||||
|
||||
(->> (d/q '[:find ?n (pull ?i [:db/id :account/numeric-code :account/location]) ?s
|
||||
:in $ ?q
|
||||
:where [(fulltext $ :account/search-terms ?q) [[?i ?n _ ?s]]]
|
||||
[?i :account/numeric-code ?numeric-code]
|
||||
(or [?i :account/applicability :account-applicability/global]
|
||||
[?i :account/applicability :account-applicability/optional])]
|
||||
(d/db conn)
|
||||
query)
|
||||
(concat (when client
|
||||
(d/q '[:find ?n (pull ?a [:db/id :account/numeric-code :account/location]) ?s
|
||||
:in $ ?c ?q
|
||||
:where
|
||||
[?i :account-client-override/client ?c]
|
||||
[(fulltext $ :account-client-override/search-terms ?q) [[?i ?n _ ?s]]]
|
||||
[?a :account/client-overrides ?i]
|
||||
[?a :account/numeric-code ?numeric-code]]
|
||||
(d/db conn)
|
||||
client
|
||||
query)))
|
||||
(sort-by (comp - last))
|
||||
(map (fn [[n a]]
|
||||
{:name (str (:account/numeric-code a) " - " n)
|
||||
:id (:db/id a)
|
||||
:location (:account/location a)}))))))
|
||||
(->> (d/q '[:find ?n (pull ?i [:db/id :account/numeric-code :account/location]) ?s
|
||||
:in $ ?q
|
||||
:where [(fulltext $ :account/search-terms ?q) [[?i ?n _ ?s]]]
|
||||
[?i :account/numeric-code ?numeric-code]
|
||||
(or [?i :account/applicability :account-applicability/global]
|
||||
[?i :account/applicability :account-applicability/optional])]
|
||||
(d/db conn)
|
||||
query)
|
||||
(concat (when client
|
||||
(d/q '[:find ?n (pull ?a [:db/id :account/numeric-code :account/location]) ?s
|
||||
:in $ ?c ?q
|
||||
:where
|
||||
[?i :account-client-override/client ?c]
|
||||
[(fulltext $ :account-client-override/search-terms ?q) [[?i ?n _ ?s]]]
|
||||
[?a :account/client-overrides ?i]
|
||||
[?a :account/numeric-code ?numeric-code]]
|
||||
(d/db conn)
|
||||
client
|
||||
query)))
|
||||
(sort-by (comp - last))
|
||||
(map (fn [[n a]]
|
||||
{:name (str (:account/numeric-code a) " - " n)
|
||||
:id (:db/id a)
|
||||
:location (:account/location a)}))))
|
||||
[])))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user