Skip to content

Conversation

@k-vasiliev
Copy link

@k-vasiliev k-vasiliev commented Jan 15, 2025

This PR adds basic support for viewing completed tasks. Users can now:

  • View completed tasks with viewCompleted: true parameter
  • Filter completed tasks by date range using completedSince and completedUntil
  • Limit the number of completed tasks shown with completedLimit
  • Auto-refresh completed task queries with a minimum interval of 9 seconds due to sync API rate limits

@k-vasiliev
Copy link
Author

resolves #233

@aamnakhan
Copy link

yay looking forward to this!

@k-vasiliev
Copy link
Author

k-vasiliev commented Jan 16, 2025

For now, it supports only the title and description of the task.

image

Also, the sync API returns labels in the "content" field, so tasks with labels look like this:

image

@k-vasiliev
Copy link
Author

@jamiebrynes7 could you take a look?

Copy link
Owner

@jamiebrynes7 jamiebrynes7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really awesome! I mostly have questions around how this is exposed to end-users and trying to resolve some of the confusion that this is introducing inside the query syntax

Comment on lines +81 to +84
debug({
msg: "Sending Todoist API request",
context: Object.fromEntries(queryParams.entries()),
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we debug log the RequestParams that gets passed into fetcher.fetch like what happens in do?

}

private getProjectById(projectId: string): Project | undefined {
return this.projects.byId(projectId);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we include the makeUnknownProject call here like with section/labels?

export type Task = {
id: TaskId;
createdAt: string;
createdAt?: string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using the completed task's completed_at for this, so I think this doesn't need to be made optional

};

const querySchema = z.object({
const baseQuerySchema = z.object({
Copy link
Owner

@jamiebrynes7 jamiebrynes7 Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be cleaner and clearer if the completed tasks were modelled as a new kind of query block with their own dedicated query schema.

To query for active tasks

```todoist
description: "Today's tasks"
filter: "today"
```

To query for completed tasks (note we can also drop the prefix as its now redundant!):

```todoist-completed
limit: 100
since: 2025-02-01
```

Rather than trying to encode the combinations in the schema here, having two independent schemas (which can still share common elements where applicable!) seems like the best way forward. It also resolves ambiguities like:

  • completedLimit/completedSince/completedUntil are meaningless if filter is provided
  • sorting/groupBy do not look like they are supported for completed tasks

import { z } from "zod";

type ErrorTree = string | { msg: string; children: ErrorTree[] };
const MIN_COMPLETED_TASKS_AUTOREFRESH = 9;
Copy link
Owner

@jamiebrynes7 jamiebrynes7 Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a call to the completed tasks API endpoint counts as a 'full sync' operation:

For each user, you can make a maximum of 1000 partial sync requests within a 15 minute period.

For each user, you can make a maximum of 100 full sync requests within a 15 minute period.

Is this being conservative or have you verified which kind this request counts as?

Its also worth noting the utility of this is somewhat lessened since a user can have any number of blocks rendered at once

@josemichaelrubio
Copy link

This feature will be a clutch for periodic reviews! Anyway, can I contribute to this via development?

@blankster
Copy link

blankster commented May 12, 2025

To everyone involved, thanks to all who are working on this 🫡 —that's something I've always wanted. 🙏

It's one thing to know what still needs to be done, but the list is often long, even when you narrow your perspective. What personally gives me the strength to do more of what I set out to do when I procrastinate is being able to clearly see what I've already accomplished, because that's something we often forget. I combine this with Habitica as additional gamification to not only feel a sense of completion but also receive direct feedback. Simply being aware of the often large list of things I've done motivates me a lot.

Ideally, this would be grouped in a hierarchical project view so it can be integrated into the daily note. Together with personal notes and other items, it would fit in perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants