mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Feature #725
- Added feature #725, which provides feedback when tasks become unblocked. - Added unit tests.
This commit is contained in:
parent
56f0281ab1
commit
9d74b55d48
7 changed files with 56 additions and 6 deletions
|
@ -94,6 +94,7 @@
|
|||
+ Added feature #710, which adds an attribute modifier prefix to return the
|
||||
complement of a filtered set (thanks to Dan White).
|
||||
+ 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 #740, that allows for indented annotations, controlled by the
|
||||
'indent.annotation' configuration variable (thanks to Steve Rader, Tomas
|
||||
|
|
|
@ -94,9 +94,10 @@ int CmdDelete::execute (std::string& output)
|
|||
if (permission (*task, question, filtered.size ()))
|
||||
{
|
||||
updateRecurrenceMask (*task);
|
||||
context.tdb2.modify (*task);
|
||||
++count;
|
||||
context.tdb2.modify (*task);
|
||||
feedback_affected (STRING_CMD_DELETE_TASK, *task);
|
||||
feedback_unblocked (*task);
|
||||
dependencyChainOnComplete (*task);
|
||||
context.footnote (onProjectChange (*task, true));
|
||||
|
||||
|
@ -117,8 +118,9 @@ int CmdDelete::execute (std::string& output)
|
|||
|
||||
updateRecurrenceMask (*sibling);
|
||||
context.tdb2.modify (*sibling);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_DELETE_TASK_R, *sibling);
|
||||
feedback_unblocked (*sibling);
|
||||
++count;
|
||||
}
|
||||
|
||||
// Delete the parent
|
||||
|
|
|
@ -95,6 +95,8 @@ int CmdDone::execute (std::string& output)
|
|||
context.tdb2.modify (*task);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_DONE_TASK, *task);
|
||||
feedback_unblocked (*task);
|
||||
context.tdb2.modify (*task);
|
||||
if (!nagged)
|
||||
nagged = nag (*task);
|
||||
dependencyChainOnComplete (*task);
|
||||
|
|
|
@ -104,10 +104,11 @@ int CmdModify::execute (std::string& output)
|
|||
if (permission (*task, taskDifferences (before, *task) + question, filtered.size ()))
|
||||
{
|
||||
updateRecurrenceMask (*task);
|
||||
context.tdb2.modify (*task);
|
||||
dependencyChainOnModify (before, *task);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_MODIFY_TASK, *task);
|
||||
dependencyChainOnModify (before, *task);
|
||||
feedback_unblocked (*task);
|
||||
context.tdb2.modify (*task);
|
||||
context.footnote (onProjectChange (before, *task));
|
||||
|
||||
// Task potentially has siblings - modify them.
|
||||
|
@ -123,11 +124,12 @@ int CmdModify::execute (std::string& output)
|
|||
Task alternate (*sibling);
|
||||
modify_task_description_replace (*sibling, modifications);
|
||||
updateRecurrenceMask (*sibling);
|
||||
context.tdb2.modify (*sibling);
|
||||
dependencyChainOnModify (alternate, *sibling);
|
||||
context.footnote (onProjectChange (alternate, *sibling));
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_MODIFY_TASK_R, *sibling);
|
||||
feedback_unblocked (*sibling);
|
||||
context.tdb2.modify (*sibling);
|
||||
context.footnote (onProjectChange (alternate, *sibling));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_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_UNBLOCKED "Unblocked {1} '{2}'."
|
||||
|
||||
// File
|
||||
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -78,6 +78,7 @@ void feedback_affected (const std::string&);
|
|||
void feedback_affected (const std::string&, int);
|
||||
void feedback_affected (const std::string&, const Task&);
|
||||
void feedback_special_tags (const Task&, const std::string&);
|
||||
void feedback_unblocked (const Task&);
|
||||
|
||||
// sort.cpp
|
||||
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue