mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Bug #1022
- Fixed bug #1022, where dependencies were note released when a blocking task was completed (thanks to Arkady Grudzinsky). - The Task object now caches ::is_blocked and ::is_blocking Booleans that are determined on pending.data load. - Simplified and sped up color rule processing using cached values, reducing the number of map lookups, and removed loop invariants when the rules are not defined. - Simplified urgency calculations given the cached values for blocked/blocking. - On load, pending.data is scanned for accurate blocked/blocking status determination. - Obsoleted and removed complex single-task dependency calculations. - Sped up 'nag' processing by using cached values.. - Modified the 'show' command to consider color.blocking to be valid. - Added default config value for color.blocking, and included it in the precedence list ahead of blocked, as it is more important. - Updated taskrc.5 man page to include the new color.blocking rule, and its place in the rule precedence.
This commit is contained in:
parent
02053f7300
commit
79e2c591f1
14 changed files with 182 additions and 178 deletions
|
@ -39,28 +39,6 @@
|
|||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A task is blocked if it depends on tasks that are pending or waiting.
|
||||
//
|
||||
// 1 --> 2(pending) = blocked
|
||||
// 3 --> 4(completed) = not blocked any more
|
||||
bool dependencyIsBlocked (const Task& task)
|
||||
{
|
||||
std::string depends = task.get ("depends");
|
||||
if (depends != "")
|
||||
{
|
||||
const std::vector <Task>& all = context.tdb2.pending.get_tasks ();
|
||||
std::vector <Task>::const_iterator it;
|
||||
for (it = all.begin (); it != all.end (); ++it)
|
||||
if ((it->getStatus () == Task::pending ||
|
||||
it->getStatus () == Task::waiting) &&
|
||||
depends.find (it->get ("uuid")) != std::string::npos)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void dependencyGetBlocked (const Task& task, std::vector <Task>& blocked)
|
||||
{
|
||||
|
@ -76,26 +54,6 @@ void dependencyGetBlocked (const Task& task, std::vector <Task>& blocked)
|
|||
blocked.push_back (*it);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// To be a blocking task, there must be at least one other task that depends on
|
||||
// this task, that is either pending or waiting.
|
||||
bool dependencyIsBlocking (const Task& task)
|
||||
{
|
||||
std::string uuid = task.get ("uuid");
|
||||
|
||||
const std::vector <Task>& all = context.tdb2.pending.get_tasks ();
|
||||
std::vector <Task>::const_iterator it;
|
||||
for (it = all.begin (); it != all.end (); ++it)
|
||||
if ((it->getStatus () == Task::pending ||
|
||||
it->getStatus () == Task::waiting) &&
|
||||
it->has ("depends") &&
|
||||
it->get ("depends").find (uuid) != std::string::npos)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void dependencyGetBlocking (const Task& task, std::vector <Task>& blocking)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue