todoist-card icon indicating copy to clipboard operation
todoist-card copied to clipboard

[FEATURE REQUEST]

Open arretx opened this issue 2 years ago • 9 comments

In the todoist-card.js file, at line 443, it appears that this is where the check for only today or overdue status is checked and filtered. I'm not a js expert (actually beginner) so I'm trying to figure out the logic here in order to solve the problem I have.

Problem: I need to be able to create a card that lists tasks that are due two days, three days, or even a week out. At the bare minimum, to be able to have two cards, one for tasks due today and one for tasks scheduled to be due tomorrow.

My experience is this: If I don't filter out tasks that are due today or past due, then I end up with a card jammed with every task in the project, when I only want to see today's outlook. So, if a task is due today, that's great, but if I'm creating a task today that's scheduled to be done tomorrow, I won't see that task on the card until midnight instead of having a card that shows "Tomorrow's Tasks" etc.

Any chance of working this out?

arretx avatar Jan 20 '23 20:01 arretx

@arretx I have implemented a filtering option to select the number of days in the future to display in a card in my forked version here: https://github.com/grinstantin/todoist-card/pull/31 (https://github.com/sw-carlos-cristobal/todoist-card/releases/tag/beta-0.0.5)

sw-carlos-cristobal avatar Jan 22 '23 07:01 sw-carlos-cristobal

Seems to be working well, but the feature I'm actually interested in is pinpointing a single day. If I do "days out" I get today and tomorrow, but if I just want to see what's on the task list for tomorrow, I can't see it without today's tasks as well.

Looks like the calculation for this is handled on 534 in your js file on your repo. Your repo doesn't have an "issues" tab so I'm responding here.

arretx avatar Jan 25 '23 21:01 arretx

Ah do you mean picking a day range ahead of time like a static x through y days in the future? Or are you looking to just ignore today and overdue tasks?

sw-carlos-cristobal avatar Jan 25 '23 21:01 sw-carlos-cristobal

Yes, to pick a single day, or range of days so you could have a card for "Today's Focus" which would be tasks that are due today, and a "Tomorrow's Focus" which would show only tasks that are due tomorrow. Or you could show a card with "3 Day Outlook" which would show all tasks for the next three days, not including today, or the next three days with an offset index. So today is Wednesday. I could have a card that shows 3 days worth of "due" tasks starting on Friday, which would be 3 days out for a range of 3 days, so "show me all tasks that have a due date in the range "friday through Sunday""

I think I'm making sense ?

arretx avatar Jan 25 '23 21:01 arretx

Yeah I think I know what you mean - I'll see what I can whip up sometime this week

sw-carlos-cristobal avatar Jan 25 '23 21:01 sw-carlos-cristobal

I think this issue can be solved with the standard Todoist functionality. You can create a filter in Todoist, and then use it with the Rest API to get the list of tasks you need. To do this, you need to create a separate filter/sensor for each of your cards.

This should work:

- platform: command_line
  name: Specific Name For This List
  scan_interval: 60
  command: >
     echo "{\"items\":" $(
     curl 
     -s 
     -H 'Authorization: Bearer TODOIST_API_TOKEN'
     'https://api.todoist.com/rest/v2/tasks?project_id=TODOIST_PROJECT_ID&filter=TODOIST_FILTER_ID'
     ) "}"
  value_template: >
     {{ value_json.items[0].project_id }}
  json_attributes:
     - items

Replace TODOIST_API_TOKEN with your token, TODOIST_PROJECT_ID with ID of your project and TODOIST_FILTER_ID with ID of the filter you created in Todoist.

Please note that you won't be able to use use_quick_add option with card based on this list. Let me know if you need it, I'll update the sensor above.

Also note that you can create only 3 filters in free Todoist's tariff plan.

grinstantin avatar Jan 26 '23 18:01 grinstantin

Personally, I'd like to just have a singular sensor per project that I can just create one card and duplicate it over and over with different settings toggled to get unique visuals.

Here is my take on a sort of "sliding window" approach. https://github.com/sw-carlos-cristobal/todoist-card/tree/sliding-window https://github.com/sw-carlos-cristobal/todoist-card/releases/tag/beta-0.0.14

sw-carlos-cristobal avatar Jan 30 '23 08:01 sw-carlos-cristobal

Personally, I'd like to just have a singular sensor per project that I can just create one card and duplicate it over and over with different settings toggled to get unique visuals.

Here is my take on a sort of "sliding window" approach. https://github.com/sw-carlos-cristobal/todoist-card/tree/sliding-window https://github.com/sw-carlos-cristobal/todoist-card/releases/tag/beta-0.0.14

That would be nice, but on the other hand - you can't just duplicate the functionality of Todoist in a HA card.

grinstantin avatar Jan 31 '23 11:01 grinstantin

Yeah I get that - but I also don't want to pay for a subscription 😁😂

sw-carlos-cristobal avatar Jan 31 '23 18:01 sw-carlos-cristobal