benjypng / logseq-kanban-plugin

MIT License
102 stars 9 forks source link

Tasks fetched by query not working #25

Closed lukas-mertens closed 1 year ago

lukas-mertens commented 1 year ago

Hey, currently I am having trouble figuring out why tasks which are pulled via a query are not showing up. Let me help you reproduce it. This is how it looks to me in a demo-graph I created to test it out:

image

In your GIF there is a button to update the tasks in the kanban board. As that is not visible I thought it might actually not be necessary anymore.

Let me give you the raw markdown of the page:

- {{renderer :kanban_xvfzgivsb}}
    - tasks
        - query-table:: true
          #+BEGIN_QUERY
          {
            :title [:h3 "Tasks" ]
            :query [
              :find (pull ?b [*])
              :where 
                    [?b :block/marker ?marker]
                    [(missing? $ ?b :block/scheduled)]
                    [?b :block/page ?page]
                    [?page :block/original-name ?name]
                ]
                :breadcrumb-show? false
                :result-transform (fn [result]
                (sort-by (fn [h] (get h :block/created-at)) result))
                :collapsed? false
          }
          #+END_QUERY

The query is inspired by the one you used in the GIF, even the exact same one didn't work either though.

Here is the markdown for a page with a few of those todos:

- #quick-project Bake cookies
    - TODO Decide for a recipe
    - TODO Buy the ingredients
    - TODO Prepare the cookies
    - TODO Put everything in the oven
    - TODO Gift cookies to friends
## Meeting-Notes
    - TODO Work on Issue ABC #inbox
## Now some clarified stuff
    - TODO Work on Issue XYZ #he #f #u #45m
    - TODO Clean room #le #60m

Adding tasks manually works great: image

My editor config: image

When disabling table-mode it doesn't work either: image

If I can give you any additional things to reproduce this, I would be happy to do so!

benjypng commented 1 year ago

Hi, please try v2.7.9.

lukas-mertens commented 1 year ago

Hey,

image

Sadly, it’s still the same situation. I don’t get any errors in the dev console either.

Bohreromir commented 1 year ago

Any updates? I can reproduce its not working

ajay126z commented 1 year ago

I think I found the issue. LogSeq Advanced query inserts 'query-table::' property at the start of Query block.

image

This breaks logic to check advanced query in the kanban plugin. image

Solution approach: This is a quick fix. I am not sure, if it breaks other thing or not. If code can be modified like below, it works fine for advanced query. image

Result: image

lukas-mertens commented 1 year ago

Thanks for figuring this out! I think you should probably match for both cases so maybe you could OR the two ways an advanced query is detected and then do a pr? Hopefully @hkgnp can merge it then

benjypng commented 1 year ago

For now, queries function only works if the query does not include any :inputs flag.