jspricke / python-icstask

Python library to convert between Taskwarrior and vObject
GNU General Public License v3.0
14 stars 5 forks source link

supporting tasks.org: existing recurring tasks #6

Open capocasa opened 1 month ago

capocasa commented 1 month ago

Trying to use icstask with open source tasks.org android app via davx5, and see if I can patch it a bit to get it to work. (tasks.org is sooooooo good)

I currently cannot update fields like 'description' on recurring tasks using tasks.org app.

example:

Input

{"description":"my task description","due":"20240731T220000Z","entry":"20240515T092213Z","modified":"20240515T090501Z","status":"pending","uuid":"a964698f-43f3-4690-b807-76eac2943990"}

Python Error

subprocess.CalledProcessError: Command '['task', 'rc.verbose=nothing', 'rc.recurrence.confirmation=no', 'rc.data.location=/path/to/my/todo.task', 'import', '-']' returned non-zero exit status 2

Taskwarrior error

You cannot remove the recurrence from a recurring task.

The difference seems to be: tasks.org assumes that the fields sent via caldav will update the fields of the target task in storage, while taskwarrior import command seems to assume incoming fields for the target task are to replace all fields but not change recurrence status.

Scratching my head. If you have any ideas on how to best fix this behavior it would be most appreciated. I thought of exporting the task, merging the json in python, and then importing, but it might be overly complicated or create undesired behavior.

jspricke commented 1 month ago

Recurring tasks in taskwarrior are (where?) internally represented by two tasks, one is something like a template and the other the current instance. I gave up on recurring tasks so support for them is rather limited in icstask. I think taskwarrior upstream changed that model in version 3.0 but I did not look into it yet. It may make sense to look at it before trying to solve this.

capocasa commented 1 month ago

Tried with taskwarrior 3, same behavior. It seems the command line interface has indeed not changed in this respect between taskwarrior major versions 2 and 3, as promised by taskwarrior documentation.

I have requested a comment from taskwarrior at GothenburgBitFactory/taskwarrior#3458, we will see if a member of the taskwarrior community might be willing to help.

I am inclined to believe that this behavior is an accident, and we could safely treat this as a limitation of task import and work around it.

capocasa commented 1 month ago

@GothenburgBitFactory kindly weighed in and says import behavior is deliberately designed as a record replace tool, suggesting to use either task mod or task export before task import for editing.

I think I'll create a patch to safely use task mod to let task do the heavy lifting and test it on my setup. What do you think?

jspricke commented 1 month ago

I don't know anymore why I chose task import, task mod sounds good to me.