blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
7.01k stars 410 forks source link

`due::` or 📅 field in a file will cause ALL tasks in file to take on that due date #1826

Open ces3001 opened 1 year ago

ces3001 commented 1 year ago

What happened?

If there is a line in a file that contains in inline field due:: or the calendar emoji 📅 followed by a date (e.g. 2023-03-03), then that due date will be applied to all tasks (that don’t have their own due date) when queried.

This can easily happen if you remove the - [ ] from a task with a due date to remove it’s task status, and the due date remains on that line. That due date will now no longer be confined to the (ex-)task it was on, and will now apply to ALL the tasks in the file.

While this may be by design, to have a global due:: inline field affect all tasks in the file, it is unexpected for a task that was dropped to have that effect. It is also not intuitive, to have a file field at the end of a line, buried in the file, affect all tasks as well.

Both DQL and JS behave the same.

DQL

TASK
WHERE due
WHERE defer <= date("2023-03-03") AND due <= date("2023-03-03") AND !completed
GROUP BY file.name

JS

https://github.com/blacksmithgu/obsidian-dataview/discussions/1509#discussioncomment-4900741

Dataview Version

0.5.55

Obsidian Version

1.1.16

OS

MacOS

xDovos commented 1 year ago

js and dql don't behave the same for that case. the thing that happens here is that you can access the metadata of the file "due::" in the TASK query, but because it is "flattening" the tasks in the background so that you don't have to write "file.tasks.due" to accesst the task metadata. now the problem is that you have a file level "due" that is accessed by "due" and a tasks level "due" that is also accessible by "due", so we have now a conflickt of field names because both are the same.