mirror of
https://github.com/logseq/logseq.git
synced 2026-04-28 08:04:40 +00:00
Add regression tests for querying properties with links
These tests were fixed by f1728c48cb
Also cleaned up more of query and tests i.e. split up large fns
This commit is contained in:
committed by
Tienson Qin
parent
5a126027eb
commit
1df386ecca
@@ -141,6 +141,7 @@
|
||||
l)
|
||||
@vars))
|
||||
|
||||
;; TODO: Convert -> fns to rules
|
||||
(defn ->property-query
|
||||
([k v]
|
||||
(->property-query k v '?v))
|
||||
@@ -155,6 +156,16 @@
|
||||
;; For integer pages that aren't strings
|
||||
[(list 'contains? sym (str v))])]))
|
||||
|
||||
(defn ->page-property-query
|
||||
[k v]
|
||||
[['?p :block/name]
|
||||
['?p :block/properties '?prop]
|
||||
[(list 'get '?prop (keyword k)) '?v]
|
||||
(list
|
||||
'or
|
||||
[(list '= '?v v)]
|
||||
[(list 'contains? '?v v)])])
|
||||
|
||||
(defn build-query
|
||||
([repo e env]
|
||||
(build-query repo e (assoc env :vars (atom {})) 0))
|
||||
@@ -354,15 +365,8 @@
|
||||
k (string/replace (name k) "_" "-")]
|
||||
(if-not (nil? v)
|
||||
(let [v (text/parse-property k v)
|
||||
v (if (coll? v) (first v) v)
|
||||
sym '?v]
|
||||
[['?p :block/name]
|
||||
['?p :block/properties '?prop]
|
||||
[(list 'get '?prop (keyword k)) sym]
|
||||
(list
|
||||
'or
|
||||
[(list '= sym v)]
|
||||
[(list 'contains? sym v)])])
|
||||
v (if (coll? v) (first v) v)]
|
||||
(->page-property-query k v))
|
||||
[['?p :block/name]
|
||||
['?p :block/properties '?prop]
|
||||
[(list 'get '?prop (keyword k)) '?prop-v]
|
||||
|
||||
Reference in New Issue
Block a user