taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

CmdStart: Fix "make this task pending" note for completed tasks

Open drehak opened this issue 3 years ago • 1 comments

Description

When trying to start a task that is already completed, the command first tries to modify the task with given arguments as an annotation. That raises a note about making the task pending, even though the task will be set as pending after the command finishes. The fix preserves the warning for other changes that do not make the completed task pending.

Reproduction of the bug

$ task done 0f57ee11
Completed task 7 'Donald the Done'.
Completed 1 task.
You have more urgent tasks.
$ task start 0f57ee11
Starting task 7 'Donald the Done'.
Started 1 task.
Note: Modified task 0f57ee11 is completed. You may wish to make this task pending with: task 0f57ee11 modify status:pending
You have more urgent tasks.
$ task 0f57ee11

Name          Value                                 
ID            7                                     
Description   Donald the Done                       
Status        Pending                               
Entered       2022-04-23 02:33:34 (29s)
Start         2022-04-23 02:33:58                   
Last modified 2022-04-23 02:33:58 (5s)
Virtual tags  ACTIVE LATEST PENDING READY UNBLOCKED 
UUID          0f57ee11-8771-4bbf-b10f-93dc768c8245
Urgency       4                                     

    active      1 *    4 =      4
                           ------
                                4

Date                Modification                                 
2022-04-23 02:33:51 End set to '2022-04-23 02:33:51'.            
                    Status changed from 'pending' to 'completed'.
2022-04-23 02:33:58 End deleted.
                    Start set to '2022-04-23 02:33:58'.
                    Status changed from 'completed' to 'pending'.

Additional information...

  • [x] Have you run the test suite?

drehak avatar Apr 23 '22 01:04 drehak

I always thought start meant the time work first began, since taskwarrior doesn't keep any history of starts or ends, and there's only one or the other but not both present in the task record. (So, timewarrior should be used for tracking starts/stops).

The task must have been meant to be restartable though, because after done then start, taskwarrior does indeed change status back to pending and replaces end with a current start.

In any case, the warning is indeed spurious, as the task is already pending when you're reminded to do that yourself.

smemsh avatar Apr 25 '22 11:04 smemsh

I suspect this is a good fix! Any chance you could rebase and push again, to get the updated statuses to pass?

djmitche avatar Mar 02 '24 21:03 djmitche