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

Tasks from some sub-projects show up but not from other sub-projects #327

Open
ahafri opened this issue Jul 17, 2024 · 7 comments
Open

Tasks from some sub-projects show up but not from other sub-projects #327

ahafri opened this issue Jul 17, 2024 · 7 comments
Labels
🐛 bug Something isn't working

Comments

@ahafri
Copy link

ahafri commented Jul 17, 2024

Describe the bug
When I have a filter for projects and sub-projects (see below), certain tasks in certain sub-projects appear but not in other sub-projects. It does not seem to be related to the title of the project (e.g., whether it contains characters like ":" or emojis). The same filter parameters appear to work fine in the Todoist application.

The filter used is:

name: Work Today Tasks
filter: "##Work 🎯 & (today | overdue)"
sorting:
   - date
   - priority
group: false

To Reproduce
I am not sure how to reproduce it. But one attempt could be:

  1. Create a main project with sub-projects, and tasks in sub-projects.
  2. Create a filter view in the plugin.
  3. See whether the tasks all appear in Obsidian.

Screenshots
image
image

Desktop: Mac OSX Sonoma 14.3.1

  • Plugin Version: 1.11.1
  • Obsidian Version: 1.6.5
@ahafri ahafri added the 🐛 bug Something isn't working label Jul 17, 2024
@jamiebrynes7
Copy link
Owner

I'm struggling to reproduce this bug, my initial thought is maybe Todoist isn't actually sending the tasks in the API response.

If you enable debug logging from the plugin settings, the raw request/responses will be logged in the developer console - then we can see which tasks are actually returned by Todoist.

Are you able to reliably reproduce this with that specific query & project setup?

@ahafri
Copy link
Author

ahafri commented Jul 19, 2024

You're right, Todoist isn't returning those tasks in the API response. Yet the same query works fine in the app proper (i.e., it returns from the sub-projects). I am kind of at a loss.

Is there a way for me to directly test different queries in the console?

@jamiebrynes7
Copy link
Owner

There's a very roundabout way by reaching into the internals of the system!

First you need to register a subscription:

const [_, refresh] = app.plugins.plugins['todoist-sync-plugin'].services.todoist.subscribe("##Test", (tasks) => console.log(tasks))

Then call the refresh callback to trigger the API call and then log to the console:

refresh()

This is asynchronous, so the tasks will appear a short while after you press enter

@ahafri
Copy link
Author

ahafri commented Jul 29, 2024

OK, I just installed the latest plugin version (1.13.0), and the API call now gives me the requested data (it wasn't before, with plugin version 1.11.1). The query retrieved in the console and what's shown in the Obsidian note are in line with one another, so the issue appears to be that the query itself does not return all the tasks that it should, based on the filter (whereas in the Todoist app itself, the same query does).

I think I pinpointed the issue: The plugin (at least for me) appears to fail at retrieving tasks that are in sub-projects of sub-projects:

Here's the plugin:
image

Here's the Todoist app. Notice the additional task ("Email undergrad...") which is under the section "Recruiting" from the "Recruiting and Branding 🆕" project (which itself is under the "Work 🎯" main project):
image

The missing task ("Email undergrad...") is one embedded at two levels of projects: "Work 🎯" > "Set Up Research 🔬" > "Recruiting and Branding 🆕". When I put the very same task one project up (in "Set Up Research 🔬") so it's just one level under the main project, the plugin succeeds at retrieving it.

@jamiebrynes7
Copy link
Owner

the API call now gives me the requested data (it wasn't before, with plugin version 1.11.1)

I take this to mean the code snippet I gave you didn't work until you updated? If so, yeah that's expected - sorry I missed you were on an old version! I rewrote the querying backend between those versions 😅

so the issue appears to be that the query itself does not return all the tasks that it should, based on the filter
[...]
I think I pinpointed the issue: The plugin (at least for me) appears to fail at retrieving tasks that are in sub-projects of sub-projects

This is great - thanks for tracing this down. I'll try and repro this myself, but regardless I'll raise an issue with Todoist (I don't work there and this is just an unofficial plugin) to try and get the API response fixed!

@ahafri
Copy link
Author

ahafri commented Jul 30, 2024

Ah, that's great! Didn't think about the fact that the issue could be on Todoist's end, but of course, that makes sense. Looking forward to seeing the resolution. (And by the way, I love your plugin; thanks for making it!)

@jamiebrynes7
Copy link
Owner

I don't think you'll be able to access this, but for my own future reference - https://get.todoist.help/hc/en-us/requests/831430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants