Quellcode durchsuchen

fix: task rule and filter for db graphs

Part of LOG-3042
Gabriel Horner vor 1 Jahr
Ursprung
Commit
4c3fc530b9
2 geänderte Dateien mit 16 neuen und 6 gelöschten Zeilen
  1. 8 1
      deps/db/src/logseq/db/frontend/rules.cljc
  2. 8 5
      src/main/frontend/db/query_dsl.cljs

+ 8 - 1
deps/db/src/logseq/db/frontend/rules.cljc

@@ -229,7 +229,14 @@
       [?b ?prop ?val]
       [(missing? $ ?b :block/name)]
       [?prop-e :db/ident ?prop]
-      [?prop-e :block/type "property"]]}))
+      [?prop-e :block/type "property"]]
+
+    :task
+    '[(task ?b ?statuses)
+      (property ?b :logseq.task/status ?v)
+      [?v :block/schema ?schema]
+      [(get ?schema :value) ?status]
+      [(contains? ?statuses ?status)]]}))
 
 (defn extract-rules
   "Given a rules map and the rule names to extract, returns a vector of rules to

+ 8 - 5
src/main/frontend/db/query_dsl.cljs

@@ -291,14 +291,17 @@
     (build-property-one-arg e)))
 
 (defn- build-task
-  [e]
+  [e {:keys [db-graph?]}]
   (let [markers (if (coll? (first (rest e)))
                   (first (rest e))
                   (rest e))]
     (when (seq markers)
-      (let [markers (set (map (comp string/upper-case name) markers))]
-        {:query (list 'task '?b markers)
-         :rules [:task]}))))
+      (if db-graph?
+        {:query (list 'task '?b (set markers))
+         :rules [:task :property]}
+        (let [markers (set (map (comp string/upper-case name) markers))]
+          {:query (list 'task '?b markers)
+           :rules [:task]})))))
 
 (defn- build-priority
   [e]
@@ -434,7 +437,7 @@ Some bindings in this fn:
 
        ;; task is the new name and todo is the old one
        (or (= 'todo fe) (= 'task fe))
-       (build-task e)
+       (build-task e env)
 
        (= 'priority fe)
        (build-priority e)