Remove references to the 'depends' property outside of Task.cpp

With the exception of `taskDifferences` and `taskInfoDifferences`,
deferred to #2572.
This commit is contained in:
Dustin J. Mitchell 2021-08-15 17:18:47 +00:00 committed by Tomas Babej
parent 9e67f4f946
commit 413b8d22b7
11 changed files with 92 additions and 92 deletions

View file

@ -36,38 +36,6 @@
#define STRING_DEPEND_BLOCKED "Task {1} is blocked by:"
////////////////////////////////////////////////////////////////////////////////
std::vector <Task> dependencyGetBlocked (const Task& task)
{
auto uuid = task.get ("uuid");
std::vector <Task> blocked;
for (auto& it : Context::getContext ().tdb2.pending.get_tasks ())
if (it.getStatus () != Task::completed &&
it.getStatus () != Task::deleted &&
it.has ("depends") &&
it.get ("depends").find (uuid) != std::string::npos)
blocked.push_back (it);
return blocked;
}
////////////////////////////////////////////////////////////////////////////////
std::vector <Task> dependencyGetBlocking (const Task& task)
{
auto depends = task.get ("depends");
std::vector <Task> blocking;
if (depends != "")
for (auto& it : Context::getContext ().tdb2.pending.get_tasks ())
if (it.getStatus () != Task::completed &&
it.getStatus () != Task::deleted &&
depends.find (it.get ("uuid")) != std::string::npos)
blocking.push_back (it);
return blocking;
}
////////////////////////////////////////////////////////////////////////////////
// Returns true if the supplied task adds a cycle to the dependency chain.
bool dependencyIsCircular (const Task& task)
@ -150,12 +118,12 @@ bool dependencyIsCircular (const Task& task)
//
void dependencyChainOnComplete (Task& task)
{
auto blocking = dependencyGetBlocking (task);
auto blocking = task.getDependencyTasks ();
// If the task is anything but the tail end of a dependency chain.
if (blocking.size ())
{
auto blocked = dependencyGetBlocked (task);
auto blocked = task.getBlockedTasks ();
// Nag about broken chain.
if (Context::getContext ().config.getBoolean ("dependency.reminder"))
@ -207,7 +175,7 @@ void dependencyChainOnStart (Task& task)
{
if (Context::getContext ().config.getBoolean ("dependency.reminder"))
{
auto blocking = dependencyGetBlocking (task);
auto blocking = task.getDependencyTasks ();
// If the task is anything but the tail end of a dependency chain, nag about
// broken chain.