obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Tasks checked via Dataview are not marked as completed using Tasks emoji

Open evanmtp opened this issue 2 years ago • 12 comments

What happened?

I'm using Dataview in conjunction with the Tasks plugin to collect tasks from across all my notes. When I check off a scheduled task (e.g. one containing the string 📅 YYYY-MM-DD, such as Tasks uses) directly in the original note, a checkbox emoji and the completion date are appended to the task, i.e. ✅ YYYY-MM-DD.

If I check off a scheduled task via Dataview, the task is marked with strikethrough, but the ✅ YYYY-MM-DD string isn't appended.

Additionally, I'm using WHERE !completed to filter out completed tasks from my task view. Scheduled tasks that contain the ✅ YYYY-MM-DD string are skipped by my Dataview queries that contain WHERE !completed. However, completed scheduled tasks that contain the 📅 YYYY-MM-DD string but not the ✅ YYYY-MM-DD string are still being collected by the queries that contain WHERE !completed.

The behaviour I expect would be for scheduled tasks to disappear from these queries when they're checked off, but as it is, the completed tasks remain visible. Non-scheduled tasks (i.e., those that don't include the 📅 YYYY-MM-DD string) do disappear as they're checked off.

DQL

TASK 
WHERE contains(text, "today") OR due = date(today) AND !completed 
GROUP BY project

JS

No response

Dataview Version

0.4.22

Obsidian Version

0.13.19

OS

Windows

evanmtp avatar Jan 26 '22 09:01 evanmtp

I will probably have to add support for this in Dataview; the tasks plugin does not understand dataview task views (it only works for tasks rendered directly in their original file by Obsidian).

blacksmithgu avatar Feb 14 '22 23:02 blacksmithgu

Just bumping this - I understand dataview has the functionality to append [completion:: YYYY-MM-DD] but is there a way we can have it mimic the Tasks convention, which is ✅ YYYY-MM-DD?

su-thomas avatar Mar 18 '22 01:03 su-thomas

Does this look like what you're looking for? https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#field-shorthands

AB1908 avatar Mar 18 '22 19:03 AB1908

Does this look like what you're looking for? https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#field-shorthands

According to that documentation and my testing, dataview can understand and query ✅ YYYY-MM-DD - but I am referring to when you actually check a task via a dataview query - it does not append ✅ YYYY-MM-DD it instead appends [completion:: YYYY-MM-DD].

su-thomas avatar Mar 19 '22 00:03 su-thomas

Ah, I see. I think we can file this as a feature request.

AB1908 avatar Mar 19 '22 17:03 AB1908

Ah, I see. I think we can file this as a feature request.

@AB1908 How can we make a feature request? Thanks

su-thomas avatar Apr 07 '22 02:04 su-thomas

We'd just have to change the title but I'm not entirely certain that writing back to the file is a good idea as it'd open up a whole different can of worms. I guess that the Tasks plugin is the way for now.

AB1908 avatar Apr 07 '22 20:04 AB1908

We'd just have to change the title but I'm not entirely certain that writing back to the file is a good idea as it'd open up a whole different can of worms. I guess that the Tasks plugin is the way for now.

@AB1908 Currently there is already feature that writes back to the file, i.e. ticking a task through a dataview query will append [completion:: YYYY-MM-DD]. I'm proposing the ability to change this to a different format in settings, such as ✅ YYYY-MM-DD. So I failing to see how this small change/feature request would open a can of worms, given the current features in dataview?

su-thomas avatar Apr 19 '22 01:04 su-thomas

You're right, I hadn't used this part of DV so I was unfamiliar with it.

AB1908 avatar Apr 19 '22 08:04 AB1908

This feature is doable and is an extension of the existing functionality. I don't think it will be too bad; will see if I can get around to it as part of 0.5 stable. Also happy to accept PRs for this.

blacksmithgu avatar Apr 20 '22 00:04 blacksmithgu

Hi @blacksmithgu, it would be great indeed if the "Automatic Task Completion Field" setting allowed the use of the emoji shorthand instead of hard-coding in a :: after the contents of that setting. Are you still looking for a PR on this?

I imagine this would require an additional Setting option so that the default remains to use the dataview inline field style? If you or anyone else on this thread has an idea of how the setting(s) should be added/reworded, I can attempt a PR.

It would be really nice if dataview had the option to write the completion in the shorthand style since it can already read it! Thanks!

AnnaKornfeldSimpson avatar Jul 21 '22 00:07 AnnaKornfeldSimpson

Also related is #1273, I think. You can attempt a draft PR and I'll provide feedback if there's any scope for improvement (I doubt you'd need my help haha). Eventually I'll defer to blacksmithgu to merge.

AB1908 avatar Jul 21 '22 08:07 AB1908

Can you check if this was fixed in the recent release?

AB1908 avatar Aug 26 '22 21:08 AB1908

This is working well for me. Thank you!

ddeighton avatar Sep 01 '22 17:09 ddeighton