A simple variation of the official TaskManagement example

$__talha131_task-management.json (1.9 KB)

This plugin makes some changes to the official TaskManagementExample (Draggable).

Major change

In the official example, when you mark a task as done, it appends done tag to the task. So your completed task tiddler will have two tags, task, done.

Problem

Completed tasks pollute task tag because, your task tag also lists completed tasks.

It makes certain operations difficult like dragging tasks up and down in order of their priority in the task tag pop-up.

Solution

This plugin has this behavior

  1. If a task is marked complete, remove task, add done
  2. If a completed (checked) task is unchecked afterwards, remove done, add task

Minor changes

  1. Add a tasks list in the sidebar
  2. Set color and icon for done tag
  3. Set color and icon for task tag
  4. Fix sort order of completed tasks
2 Likes

Please suggest code improvements

To remove the tag done and add tag task when checkbox is unchecked, I used the following code

\define uncheckActions() <$action-sendmessage $message="tm-remove-tag" $param="done"/> <$action-sendmessage $message="tm-add-tag" $param="task"/>

<$fieldmangler>
<$checkbox filter="[<currentTiddler>tag[done]]" uncheckactions=<<uncheckActions>> > 
~~<$link/>~~
</$checkbox>
</$fieldmangler>

To remove the tag task and add tag done when checkbox is checked, I used the following code

\define checkActions()  <$action-sendmessage $message="tm-remove-tag" $param="task"/> <$action-sendmessage $message="tm-add-tag" $param="done"/>

<$fieldmangler>
<$checkbox filter="[<currentTiddler>tag[done]]" checkactions=<<checkActions>> > 
<$link/>
</$checkbox>
</$fieldmangler>

Great stuff, thank you @talha131. I’d welcome tiddlywiki.com updates – perhaps we could expand the task management examples into a series of progressive lessons that gradually add features.

4 Likes

I suggest:

  • Use <$action-listops> instead of “tm-remove-tag” and “tm-add-tag”. This eliminates the need for the surrounding <$fieldmangler> widget.

  • Add some newlines and indentation for improved code readability.

Thus, TaskManagementExample (Draggable) would contain:

This is a version of the TaskManagementExample enhanced with the ability to drag and drop the task list to re-order them.

! Outstanding tasks
//Drag the tasks to re-order them//
<<list-tagged-draggable tag:"task"
      subFilter:"!has[draft.of]!tag[done]"
   itemTemplate:"TaskManagementExampleDraggableTemplate"
   emptyMessage:"<div>You don't have any active tasks</div>">>

! Completed tasks
//(Listed in reverse order of completion)//
<$list filter="[!has[draft.of]tag[done]!sort[modified]]"
   emptyMessage="<div>You don't have any completed tasks</div>">
   <div>
      <$checkbox tag="done" uncheckactions="<$action-listops $tags='-done +task'/>">
         ~~<$link/>~~
      </$checkbox>
   </div>
</$list>

and TaskManagementExampleDraggableTemplate would contain:

<$checkbox tag="done" checkactions="<$action-listops $tags='-task +done'/>">
   <$link/>
</$checkbox>

-e

5 Likes

I think it’s not necessarily a pollution. … The task is still a task. It’s done.

The main problem with your solution for me is, that a done task, if opened as a tiddler in the story river has no evidence anymore, that it has ever been a task.

It’s tagged: “done” and “TaksManagementExample” … but “task” is missing now and that is “loss of information” which I think is a problem.

It may be only me, but that’s how I see it. Tiddlers should contain enough information, that they are useful if they are used alone.

I’m in agreement with @pmario… just because a task is completed, doesn’t mean it’s no longer a task. To retain the “task” tag in my previously posted code, make the following changes:

  • in “TaskManagementExample (Draggable)”, change
    <$action-listops $tags='-done +task'/> to <$action-listops $tags='-done'/>
  • in “TaskManagementExampleDraggableTemplate” change
    <$action-listops $tags='+done -task'/> to <$action-listops $tags='done'/>

Note that this also fixes a problem where using “+task” and “+done” was also removing any other tags on the target tiddler.

-e

1 Like

Thank you @EricShulman. I will try $action-listops. It certainly looks much concise.

It will certainly open a PR for this once I finish using $action-listops.

How about this?

  1. A task tiddler always stays tagged as task
  2. If it is undone, it is marked as todo (task and todo)
  3. If it is done, it is marked as done (task and done)

So a task tiddler can have either of two states

  1. todo, or
  2. done

Let me know what you think.


Though, in my mental model, a tiddler tagged with done WAS a task. And a tiddler tagged with task IS a task.

And using a filter like [tag[task]] [tag[done]] will get me a list of all “tasks”.

But now I am doubting myself after yours and @EricShulman post.

“todo” tasks match filter: [tag[task]!tag[done]]
“done” tasks match filter: [tag[task]tag[done]]

  1. This eliminates the need for adding a “todo” tag when creating a task (just tag it with “task”)
  2. This allows “done” to be used separately for other, non-task tiddlers

-e

2 Likes

Eric, the problem I have is that I want to arrange “undone” tasks in order of their priority by dragging them in the task tag pill popup.

If the task tag also contains done tasks, then it makes dragging in the tag pill popup clumsy because of “pollution”.

Ah. I see now why you want a separate todo tag. You can then arrange tasks in order of their priority by dragging them in the todo tag pill popup without the “pollution” of the done tasks (that would still appear in the task tag pill popup).

-e

1 Like

But is that something you’d propose for the official TaskManagement Example - or is it just for your own stuff? If it is for your own stuff… then just tag the tasks any way you want :wink:

I think it’s not the TaskManagementExample problem you want to solve it’s “Can a tagpill always be used to sort by priority”. I think the TaskManagementExample in the docs, should stay as it is.

The problem “Can a tagpill always be used to sort by priority” can be discussed here.

and imo the answer is “no” … because

The system with sorting with a tag-pill will break down as soon as you have 2 projects/contexts, that can use the same tag to identify “what is a task”. eg:

The stepdaughter has to

  • take out the bread
  • harvest apples
  • make the bed

Frodo has to

  • get the ring
  • go to Mordor
  • find a way in

At the beginning all responsibilities may be tagged “task” or “todo” … But they can’t be prioritized using the “task” or “todo” tag pills, since the “assignees” or the “context” is a different one.

The priority information is bound to “the context” and the “task”, so both of them have to be uses to create a priority list.

1 Like