- Added feature #725, which provides feedback when tasks become unblocked.
- Added unit tests.
This commit is contained in:
Paul Beckingham 2012-02-26 13:08:40 -05:00
parent 56f0281ab1
commit 9d74b55d48
7 changed files with 56 additions and 6 deletions

View file

@ -94,6 +94,7 @@
+ Added feature #710, which adds an attribute modifier prefix to return the + Added feature #710, which adds an attribute modifier prefix to return the
complement of a filtered set (thanks to Dan White). complement of a filtered set (thanks to Dan White).
+ Added feature #714, including Belarus holidays (thanks to Alexei Romanoff). + Added feature #714, including Belarus holidays (thanks to Alexei Romanoff).
+ Added feature #725, which provides feedback when tasks become unblocked.
+ Added feature #733, including Czech holidays (thanks to Tomas Cech). + Added feature #733, including Czech holidays (thanks to Tomas Cech).
+ Added feature #740, that allows for indented annotations, controlled by the + Added feature #740, that allows for indented annotations, controlled by the
'indent.annotation' configuration variable (thanks to Steve Rader, Tomas 'indent.annotation' configuration variable (thanks to Steve Rader, Tomas

View file

@ -94,9 +94,10 @@ int CmdDelete::execute (std::string& output)
if (permission (*task, question, filtered.size ())) if (permission (*task, question, filtered.size ()))
{ {
updateRecurrenceMask (*task); updateRecurrenceMask (*task);
context.tdb2.modify (*task);
++count; ++count;
context.tdb2.modify (*task);
feedback_affected (STRING_CMD_DELETE_TASK, *task); feedback_affected (STRING_CMD_DELETE_TASK, *task);
feedback_unblocked (*task);
dependencyChainOnComplete (*task); dependencyChainOnComplete (*task);
context.footnote (onProjectChange (*task, true)); context.footnote (onProjectChange (*task, true));
@ -117,8 +118,9 @@ int CmdDelete::execute (std::string& output)
updateRecurrenceMask (*sibling); updateRecurrenceMask (*sibling);
context.tdb2.modify (*sibling); context.tdb2.modify (*sibling);
++count;
feedback_affected (STRING_CMD_DELETE_TASK_R, *sibling); feedback_affected (STRING_CMD_DELETE_TASK_R, *sibling);
feedback_unblocked (*sibling);
++count;
} }
// Delete the parent // Delete the parent

View file

@ -95,6 +95,8 @@ int CmdDone::execute (std::string& output)
context.tdb2.modify (*task); context.tdb2.modify (*task);
++count; ++count;
feedback_affected (STRING_CMD_DONE_TASK, *task); feedback_affected (STRING_CMD_DONE_TASK, *task);
feedback_unblocked (*task);
context.tdb2.modify (*task);
if (!nagged) if (!nagged)
nagged = nag (*task); nagged = nag (*task);
dependencyChainOnComplete (*task); dependencyChainOnComplete (*task);

View file

@ -104,10 +104,11 @@ int CmdModify::execute (std::string& output)
if (permission (*task, taskDifferences (before, *task) + question, filtered.size ())) if (permission (*task, taskDifferences (before, *task) + question, filtered.size ()))
{ {
updateRecurrenceMask (*task); updateRecurrenceMask (*task);
context.tdb2.modify (*task); dependencyChainOnModify (before, *task);
++count; ++count;
feedback_affected (STRING_CMD_MODIFY_TASK, *task); feedback_affected (STRING_CMD_MODIFY_TASK, *task);
dependencyChainOnModify (before, *task); feedback_unblocked (*task);
context.tdb2.modify (*task);
context.footnote (onProjectChange (before, *task)); context.footnote (onProjectChange (before, *task));
// Task potentially has siblings - modify them. // Task potentially has siblings - modify them.
@ -123,11 +124,12 @@ int CmdModify::execute (std::string& output)
Task alternate (*sibling); Task alternate (*sibling);
modify_task_description_replace (*sibling, modifications); modify_task_description_replace (*sibling, modifications);
updateRecurrenceMask (*sibling); updateRecurrenceMask (*sibling);
context.tdb2.modify (*sibling);
dependencyChainOnModify (alternate, *sibling); dependencyChainOnModify (alternate, *sibling);
context.footnote (onProjectChange (alternate, *sibling));
++count; ++count;
feedback_affected (STRING_CMD_MODIFY_TASK_R, *sibling); feedback_affected (STRING_CMD_MODIFY_TASK_R, *sibling);
feedback_unblocked (*sibling);
context.tdb2.modify (*sibling);
context.footnote (onProjectChange (alternate, *sibling));
} }
} }
} }

View file

@ -689,6 +689,7 @@
#define STRING_FEEDBACK_TAG_NONAG "The 'nonag' special tag will prevent nagging when this task is modified." #define STRING_FEEDBACK_TAG_NONAG "The 'nonag' special tag will prevent nagging when this task is modified."
#define STRING_FEEDBACK_TAG_NOCAL "The 'nocal' special tag will keep this task off the calendar report." #define STRING_FEEDBACK_TAG_NOCAL "The 'nocal' special tag will keep this task off the calendar report."
#define STRING_FEEDBACK_TAG_NEXT "The 'next' special tag will boost the urgency of this task so it appears on the 'next' report." #define STRING_FEEDBACK_TAG_NEXT "The 'next' special tag will boost the urgency of this task so it appears on the 'next' report."
#define STRING_FEEDBACK_UNBLOCKED "Unblocked {1} '{2}'."
// File // File
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'." #define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."

View file

@ -365,4 +365,45 @@ void feedback_special_tags (const Task& task, const std::string& tag)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Called on completion, deletion and update. If this task is blocking another
// task, then if this was the *only* blocking task, that other task is now
// unblocked. Mention it.
//
// Implements:
// Unblocked <id> '<description>'
void feedback_unblocked (const Task& task)
{
if (context.verbose ("affected") ||
context.config.getBoolean ("echo.command")) // Deprecated 2.0
{
// Get a list of tasks that depended on this task.
std::vector <Task> blocked;
dependencyGetBlocked (task, blocked);
// Scan all the tasks that were blocked by this task
std::vector <Task>::iterator i;
for (i = blocked.begin (); i != blocked.end (); ++i)
{
std::vector <Task> blocking;
dependencyGetBlocking (*i, blocking);
if (blocking.size () == 0)
{
if (i->id)
std::cout << format (STRING_FEEDBACK_UNBLOCKED,
i->id,
i->get ("description"))
<< "\n";
else
{
std::string uuid = i->get ("uuid");
std::cout << format (STRING_FEEDBACK_UNBLOCKED,
i->get ("uuid"),
i->get ("description"))
<< "\n";
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -78,6 +78,7 @@ void feedback_affected (const std::string&);
void feedback_affected (const std::string&, int); void feedback_affected (const std::string&, int);
void feedback_affected (const std::string&, const Task&); void feedback_affected (const std::string&, const Task&);
void feedback_special_tags (const Task&, const std::string&); void feedback_special_tags (const Task&, const std::string&);
void feedback_unblocked (const Task&);
// sort.cpp // sort.cpp
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&); void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);