pengx17 / logseq-plugin-todo-master

A simple plugin to render a progress bar to gather the overall progress of the TODO markers based on the rendering position.
MIT License
121 stars 14 forks source link

Progress bar inside query not working, seems not updating #31

Open kumaresh0 opened 1 year ago

kumaresh0 commented 1 year ago

Progress bar inside query not working, seems not updating

Query used:

+BEGIN_QUERY

{:title "{{renderer :todomaster}}" :query [:find (pull ?b [* {:block/_parent ...}]) :where [?b :block/marker ?marker] [(contains? #{"LATER" "NOW" "TODO" "DOING"} ?marker)]

[?b :block/ref-pages ?p]
[?p :block/name ?tag]
[(contains? #{"personal"} ?tag)]]

}

+END_QUERY


Screenshot latest logseq release .10

image
kumaresh0 commented 1 year ago
#+BEGIN_QUERY
   { :title "{{renderer :todomaster}}"
        :query 
                [:find (pull ?b [*])
                :where
                        [?b :block/marker ?m]
                        [(contains? #{"TODO" "LATER" "DOING" "NOW"} ?m)]
                        [?b :block/ref-pages ?p]
                        [?p :block/name ?tag]
                        [(contains? #{"personal"} ?tag)]
                        ]
                :result-transform 
                        (fn [result] (sort-by (fn [h] (get-in h [:block/priority])) result))
        :breadcrumb-show? false
        :collapsed? true}
#+END_QUERY
ajay126z commented 1 year ago

I think purpose of TODO master progress bar is to provide percentages of todo, doing and done tasks. You are searching tasks which have status either TODO or DOING. Can you try to modify the the query like below and see the result.

+BEGIN_QUERY

{ :title "{{renderer :todomaster}}" :query [:find (pull ?b [*]) :where [?b :block/marker ?m] [(contains? #{"TODO" "LATER" "DOING" "NOW" "DONE"} ?m)] [?b :block/ref-pages ?p] [?p :block/name ?tag] [(contains? #{"personal"} ?tag)] ] :result-transform (fn [result] (sort-by (fn [h] (get-in h [:block/priority])) result)) :breadcrumb-show? false :collapsed? true}

+END_QUERY