HeroBlackInk / ultimate-todoist-sync-for-obsidian

GNU General Public License v3.0
145 stars 20 forks source link

Tasks synced with Todoist can't be found by Obsidian Task query with due date criteria #61

Open rootless0724 opened 11 months ago

rootless0724 commented 11 months ago

I use "Todoist Ultimate Sync" with community plugin "Tasks" and "Daily Notes"

The use case is that:

  1. While I take notes, I also create tasks along with the note with due dates
  2. In Daily Notes I insert the following code to remind myself on tasks due today or overdue, by the following block
due on or before today
not done
sort by due reverse

It works by showing all tasks in all the notes due today or already overdue.

However when creating tasks with tag which triggers Ultimate Todoist Sync (ex. - [ ] test todoist task sync 📅 2023-10-10),

I see the plugin creates a Todoist task link and properly synced to Todoist. But then the task does not appear on the "due or overdue" query I did above.

Actually, my finding is that 1) only the tasks synced by Ultimate Todoist Sync won't respond to Task queries with due date criteria 2) the tasks synced by by Ultimate Todoist Sync will still appear correctly when the query is without due date criteria (ex. For the task [ ] test todoist task sync 📅 2023-10-10)

It will appear in the following Task query, with the due date information.

not done

3) By testing it couple of times, it seems that before the task is synced with Todoist (when the link id is not automatically generated), the task temporarily appeared in the due date query result. Then after the sync is done, the task disappears. It's like the sync did something to the task due date, that the due date is still there but wouldn't work with the Task Query mechanism anymore.

Would you please look into it and let me know if there is any fix and workaround? Thank you.

craigeley commented 9 months ago

I see what is happening here, and there is a workaround for this. It is about the order of populating certain fields when using the Tasks plugin. In order to see your queries, the Due Date has to be the last field of the entry. So, in my testing, creating a task must be done in this order:

  1. Create the task and give it a name and appropriate tags
  2. Add the "#todoist" tag, which pretty much instantly creates the id comment block
  3. THEN add the due date from the Tasks HUD. That puts the due date last, and makes it responsive to the kinds of queries you are trying to execute.

Hope that helps!

Druzco commented 9 months ago

I also had this issue, all my dataviews turned empty. But your solution works. I am glad I set this up before all my tasks have dates. Could be useful to add to the Readme..