Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for alternate checkbox tasks #812

Open
jwd-iv opened this issue Jan 26, 2022 · 32 comments
Open

Support for alternate checkbox tasks #812

jwd-iv opened this issue Jan 26, 2022 · 32 comments
Assignees
Labels
beta-available effort-medium This will require some thought but is fixable without major changes. feature-request New feature or request.

Comments

@jwd-iv
Copy link

jwd-iv commented Jan 26, 2022

I've been using alternate checkboxes to track different task states, inspired by SlRvb's implementation in their ITS theme, and I've discovered that Dataview only recognizes checkboxes that have ' ', 'x', or 'X' in the box. Dataview ignores top-level checklist items that have any other character in the box, and nested alternate checklist items include "[char] " in their text.

Ideally, Dataview could recognize any bulleted item with any single character in the box at the front as a task. It would also be helpful to include that character as the task's state, status, type, or something along those lines.

Possible extensions:

  • Numerical tasks like - [2/10] Do this thing 10 times
  • Unicode glyphs (e.g. emoji)
@jwd-iv jwd-iv added the feature-request New feature or request. label Jan 26, 2022
@AB1908
Copy link
Collaborator

AB1908 commented Mar 5, 2022

cc @eleanorkonik

@eleanorkonik
Copy link

I would love to retire this dataviewjs for what it's worth. https://gist.github.com/eleanorkonik/c650c193751436463f427690f680546e

@blacksmithgu
Copy link
Owner

Will be available as task.status in the next major update.

@stoweboyd
Copy link

When is the next major update planned?

@AB1908
Copy link
Collaborator

AB1908 commented Mar 22, 2022

@stoweboyd, it's in beta already! Go test it out!

@blacksmithgu
Copy link
Owner

It's currently available in beta (0.5.0) - you can use the Obsidian BRAT plugin to pick up beta releases.

@stoweboyd
Copy link

stoweboyd commented Mar 23, 2022

I tried it, and a bunch of my Taskidian queries broke. I'll wait until there is a detailed write-up.

And I tried task.status and that didn't work either. Maybe I am not configuring options correctly.

@blacksmithgu blacksmithgu added effort-medium This will require some thought but is fixable without major changes. beta-available labels Mar 24, 2022
@blacksmithgu
Copy link
Owner

In task queries it is just available as status (WHERE status = '<' for example).

Please share any broken task queries you have - the beta release is predominantly for me to catch breaking changes like queries not working.

@stoweboyd
Copy link

stoweboyd commented Mar 26, 2022

this query no longer works:

due today

TASK 
WHERE !completed 
WHERE (due = date(2022-03-26))
GROUP BY ø

Note: 'ø' is an attribute on in my task system, '- [ ] [ø:: !]' is an urgent task, for example. This will be replaced by '- [!]' when this evolution of dataview settles down.

due today

All my other 'due this week' type queries break in the same way

@stoweboyd
Copy link

stoweboyd commented Mar 26, 2022

I tried this query:

TASK FROM "00 workings"
WHERE !completed 
WHERE status = '!'

And got an error:

urgent

so the "status = '!'" doesn't seem to work. Likewise when trying as a string "!".

@AB1908
Copy link
Collaborator

AB1908 commented Mar 26, 2022

The checkbox character doesn't look like it's being picked up ATM.

@blacksmithgu
Copy link
Owner

Use double quotes and not single quotes for strings - WHERE status = "!".

@stoweboyd
Copy link

I tried with double quotes (again). No worko.

Screen Shot 2022-03-27 at 4 47 32 PM
Screen Shot 2022-03-27 at 4 47 41 PM

And still getting the 'maximum call stack size exceeded', too.

@blacksmithgu
Copy link
Owner

blacksmithgu commented Apr 2, 2022

@stoweboyd The reason your query is not working is because you are filtering on completed - completed is true as long as the status is not empty, to mimic Obsidian default rendering behavior, so a task marked '!' is considered completed. Just get rid of that check:

TASK FROM "00 workings"
WHERE status = "!"

@blacksmithgu
Copy link
Owner

I can consider changing the semantics of completed while still in beta to only be true if the task status is 'x' or 'X'; I'm not sure if that would break any existing behavior. Possibly not.

Also, do you have some dummy example tasks that show the broken "stack call exceeded error"? I've fumbled with some basic GROUP BY task queries but been unable to break it.

@stoweboyd
Copy link

stoweboyd commented Apr 6, 2022 via email

@stoweboyd
Copy link

stoweboyd commented Apr 7, 2022 via email

@blacksmithgu
Copy link
Owner

This seems very odd and broken; the only way this call stack issue can happen is if the Obsidian metadata cache reports that a list element has a parent of itself or some other bad construction.

I've added an assertion to guard against this case, which may not fix the views but at least will give a more useful error. It's included in new release 0.5.8.

@ebullient
Copy link
Contributor

ebullient commented Apr 25, 2022

For reference/comparison/assurance:

  • Task Collector doesn't fuss with default browser behavior of checked (has a value)
  • I do treat either x or X as completed. You can opt-in to also treating - as completed.
    • A recent ask was to suppress/remove X from this list, which I've done.
  • You can then specify values for "incomplete" items (as a simple string).
    • If you removed X from the above list, it is eligible to be included here instead.

Snippetor looks for these settings to help people set up custom/styled snippets:

So I would suggest that dataview keep the HTML semantics of checked (has a non-empty value or not), and avoid crossing that with the meaning of "completed" (which we are all actively turning into something else). Specifically, this:

@ebullient
Copy link
Contributor

ebullient commented Apr 25, 2022

To get the Task Collector completion modal to work with dataview, I would need to override or augment what is happening here:

const onChecked = (evt: preact.JSX.TargetedEvent<HTMLInputElement>) => {

e.g. to allow dataview to open the task collector modal so someone could specify what value to mark the item with. Given this is a callback assigned directly on the item, I am a bit at a loss for how best to try to do anything else. I can intercept the click, but I don't then have the context to update the document with the character in a way that makes sense..

@blacksmithgu
Copy link
Owner

I'll need to add an API option for overriding the click handler - that way Dataview can provide the task metadata and source file.

@ebullient
Copy link
Contributor

that would be amazing!

@ebullient
Copy link
Contributor

ebullient commented Apr 26, 2022

This will help with themes/snippets applying properly. The currently generated tasks don't have the information where snippets/themes expect it: #1047

@ebullient
Copy link
Contributor

ebullient commented Apr 26, 2022

This works (for using the task collector modal to get the status character): #1048

@foenixp
Copy link

foenixp commented May 26, 2022

I am not sure if I should put the issue I have here, please let me know. So now "status" becomes an implicit field for dataview, I seem to not be able to filter my page level "status" field at Where clause anymore. Will there be a solution for this, or do I have to change my "status" field for something else for sure?
I have a project with status:: [[active]] for example. On this project page, I have several tasks under two sections.
In another note, I used dataview task to list those tasks:

from "folder" 
where contains(type, [[note]]) and contains(category,[[project]]) and contains(status, [[active]])
where contains(meta(section).subpath, "action items 1")
group by section
sort due asc

@AB1908
Copy link
Collaborator

AB1908 commented May 31, 2022

Good point, I think you'd have to change the status field. A simple search and replace should suffice.

@stoweboyd
Copy link

stoweboyd commented Oct 11, 2022 via email

@stoweboyd
Copy link

stoweboyd commented Oct 11, 2022 via email

@AB1908
Copy link
Collaborator

AB1908 commented Oct 11, 2022

Let us know so we can close the issue.

@tiagobrc
Copy link

I use this code to list the top notes with unchecked tasks, but it counts alternate checkboxes as non-completed. How can I make it also count alternat checkboxes as completed?

TABLE length(filter(file.tasks, (t) => !t.completed)) AS "Uncompleted" WHERE file.tasks AND length(file.tasks) > 0 AND length(filter(file.tasks, (t) => !t.completed)) > 0 SORT length(filter(file.tasks, (t) => !t.completed)) DESC

@AB1908
Copy link
Collaborator

AB1908 commented Mar 23, 2023

@tiagobrc can you repost that in a discussion? This is mostly issue related stuff and I'd hate to clutter the thread.

@rollingtatoo
Copy link

I think this might be very useful
https://forum.obsidian.md/t/get-task-type-in-dataviewjs/54311/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-available effort-medium This will require some thought but is fixable without major changes. feature-request New feature or request.
Projects
None yet
Development

No branches or pull requests

9 participants