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

[BUG] Task recurrence still broken on v3 #204

Closed
silentjay opened this issue Nov 13, 2024 · 14 comments
Closed

[BUG] Task recurrence still broken on v3 #204

silentjay opened this issue Nov 13, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@silentjay
Copy link

Expected behaviour:
Set recurrence to 1d on a task and due date to today. Complete the task. The next day expect the task to be marked uncompleted and due date changed to the new day.

Current Behaviour:
The next day the task is still in it's completed state and due date is still set to yesterday. Closing down dooit and reopening doesn't change the tasks state.

@silentjay silentjay added the bug Something isn't working label Nov 13, 2024
@kraanzu
Copy link
Member

kraanzu commented Nov 13, 2024

OK there might be a few more bugs. Recurrence totally slipped my mind. Thanks for opening this

@kraanzu kraanzu mentioned this issue Nov 14, 2024
Copy link

Did we solve your problem?
Glad we could help!

Consider sponsoring my work through github sponsors 😄
@kraanzu

@silentjay
Copy link
Author

Thanks for looking into this. Have updated dooit and will test the recurrence functionality out over the next few days.

@silentjay
Copy link
Author

silentjay commented Nov 15, 2024

Now that the recurrence is working (I think) it's different to how I thought it would work. I imagined it would work something like Todoist where recurring todos once marked completed stay completed until their new due date (say 2 days time) where they are then marked as uncompleted.

From what I can see dooit leaves the todo in an uncompleted state, not letting you mark the todo as completed, then just advances the due date, is that correct?

@kraanzu
Copy link
Member

kraanzu commented Nov 15, 2024

Now that the recurrence is working (I think) it's different to how I thought it would work. I imagined it would work something like Todoist where recurring todos once marked completed stay completed until their new due date (say 2 days time) where they are then marked as uncompleted.

True, I was actually going in the same direction but I was not able to implement it properly and there was one other issue open so I first made the priority to push a patched release first
As you can see in f6b8d07, it says basic. I also hade some issue regarding that the workflow you mentioned

Maybe you can answer it.

For example, you have a todo for a daily task. You mark it complete for today. and then, well since you're free and you do want to mark future recurrence as completed as well, how do you do that?

User workflow:

Note

o means pending and x means completed

o My task (due: today)

marks completed

x My Task (due: Tommorrow)

Now how do the user mark it complete for the day after tommorow?

@kraanzu
Copy link
Member

kraanzu commented Nov 15, 2024

Also remembered another use case:

Lets say you set recurrence for every 1 month or 6 months or any other large value, then you'll only be reminded about that task on the exact day. Which is fine for a lot of cases, but might not be for some cases?

@silentjay
Copy link
Author

Also remembered another use case:

Lets say you set recurrence for every 1 month or 6 months or any other large value, then you'll only be reminded about that task on the exact day. Which is fine for a lot of cases, but might not be for some cases?

I completely understand where you're coming from. I took another look to see how todoist handles recurring tasks and it seems to be much like how you've implemented in dooit so I was wrong there. You'e just able to use filters to hide recurring completed tasks and also the due date doesn't get incremented each time you complete on the same day.

Looking at dooit I don't think there's really an easy way to implement having the option of being able to hide completed recurring tasks as it doesn't track todos completion history. I guess you could have a 3rd state (completed, uncompleted, recur_completed?) although I suspect even this might have issues.

@kraanzu
Copy link
Member

kraanzu commented Nov 16, 2024

I guess you could have a 3rd state (completed, uncompleted, recur_completed?) although I suspect even this might have issues.

Hmm...No I think this will make things complicated a lot + will be a breaking change

I first thought maybe the user can set a threshold as to when to show the task as completed or not
But I guess this would messup recurrence tasks with short timedelta

And I dont want to mess up the implementation too much yk which will make it hard for devs and users as well haha
Whatever I can think of right now sounds too much ambigous and a complicated workflow for such a simple thing

However...

I have some ideas which are just visual changes via scripts:


1. Push down recurrence Tasks

The simplest thing I could think of was to make a plugin/script which will do the following steps:

  • Keep track of TodoDueChange event
  • Get the todo whose due changed
  • Check if the todo has a recurrence value set, if not, skip the rest of the steps
  • Push the todo down based on the new due date

This means frequently done tasks will still be in the lists
And for tasks which are to be done like every 6 months or so..will be there but at the very down


2. Psuedo Complete Tasks

This script will take an initial threshold of timedelta and will format the todos based on that it'll dimmify the task + set a custom icon for the status as well.

This is like a combination of two formatters but only for recurrence tasks:

First, if you remember the Strike Completed formatter, we'll strike and dim alll the tasks which are

  1. which are completed (ie the next due is in the future)
  2. are above threshold (for example only dimmify and strike the todos which are to be done after 1 week)

Second, we'll use the Status Icons formatter which will set a custom icon for todos which follow the same 2 conditions as above. Since we know that recurrence items are always pending tasks, we'll override the pending icon only :D


!Bonus!: Ofcouse both of the above said things can be done simultaneously as well

Lemme know your thoughts on this + if something was unclear :)
Also, if it seems something interesting and you'd like to do, I can help ya as well because I think I still need to add a developer guide to the docs 😅

@silentjay
Copy link
Author

silentjay commented Nov 16, 2024

Not sure about suggestion 1, as it wouldn't be obvious to users why certain tasks are being pushed down in the list. It'll act as a type of sub-sort to their current sort selection. Could be quite confusing?

I think I prefer suggestion 2 with a custom status icon which would give users an indication why the recurring task is struck through/dimmed. However won't this now require recurring todos being marked as complete, meaning users will have to wait until it's due again to be able to complete it again and require code to mark them as pending when the due date comes around? Also the timedelta of 1 week or whatever seems completely arbitrary to me and most likely confusing once again for users?

Am happy to have a go at working on this if we can find a good way of implementing it which doesn't have to be shoe horned into your existing code or end up confusing users.

I was going to look at how TimeWarrior handled recurring tasks but then I think I looked into it a few years ago and the answer was...poorly.

@kraanzu
Copy link
Member

kraanzu commented Nov 17, 2024

Not sure about suggestion 1, as it wouldn't be obvious to users why certain tasks are being pushed down in the list. It'll act as a type of sub-sort to their current sort selection. Could be quite confusing?

Ofcourse this is not the default/baked-in implementation, users can add the script if you want :) Just like the striked completed tasks

it's due again to be able to complete it again and require code to mark them as pending when the due date comes around?

No. As I mentioned, this is just a visual change. Just the icon is replaced with something else. Users can still complete the task and the due task will still remain pending and the due date will be moved fwd. We are just fancy decorating the task so its just LOOKS LIKE ITS COMPLETE. again, this is an optional thing if the user chooses to include this behaviour

Am happy to have a go at working on this if we can find a good way of implementing it which doesn't have to be shoe horned into your existing code or end up confusing users.

Sure. I can help ya out, as I mentioned, I think the docs is still lacking in terms of developer guide so It'll be great for me as well to check out things as to whats needeed more

I was going to look at how TimeWarrior handled recurring tasks but then I think I looked into it a few years ago and the answer was...poorly.

Yea I think there is not any good solution as it highly depends on the usecase :)

@kraanzu
Copy link
Member

kraanzu commented Nov 17, 2024

Also, I've started to work on two plugins. Hopefully I'll have a basic version by today so maybe that can be something you can check out as well. But for now the most relevant things to look would be:

  1. Formatters
  2. Status Icon Formatter
  3. Strikethrough Formatter

Note

You might see .markup in some areas which use Text class from rich but maybe its not needed

@silentjay
Copy link
Author

No. As I mentioned, this is just a visual change. Just the icon is replaced with something else. Users can still complete the task and the due task will still remain pending and the due date will be moved fwd. We are just fancy decorating the task so its just LOOKS LIKE ITS COMPLETE. again, this is an optional thing if the user chooses to include this behaviour

Got it, so it'll just be another script using the API to go in the config. One case which comes to mind if you're going down this route is that won't this only work if the user doesn't close down and reopen dooit? Soon as they do then with the task still in the pending state it'll lose the visual change to show it's a "completed" recurring task and revert visually to being pending again right?

@kraanzu
Copy link
Member

kraanzu commented Nov 17, 2024

I'm not sure if I understand correctly.

revert visually to being pending again right?

I guess you're thinking it something like this:

  1. There's a recurring todo
  2. User marks todo as complete
  3. As soon as this happens, the todo is visually changed because the new due date is in the future now
  4. The user closes dooit
  5. User opens dooit again, and sees the visual changes are gone?

But the formatters work on a condition, todo will be formatted based on the due date. So it doesn't matter if the app is closed or open since the due date is changed.

One good example is the overdue status icon, it changes if the due date has already passed. Think of the visual changes as the same, but on more items (ie strike, dimmification on the description etc)

@silentjay
Copy link
Author

You're description of my thinking is correct. I'll wait until you push the scripts onto github and hopefully I can get my head around it then!

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