Dependencies - info

- Added blocked and blocking tasks to the info report.
This commit is contained in:
Paul Beckingham 2010-07-12 20:24:29 -04:00
parent 19b803312f
commit 54cf7e5471
2 changed files with 36 additions and 1 deletions

View file

@ -603,7 +603,7 @@ int handleCustomReport (const std::string& report, std::string &outs)
foreach (task, tasks)
{
task->getDependencies (all);
join (deps, " ", all);
join (deps, ", ", all);
context.hooks.trigger ("format-depends", "depends", deps);
table.addCell (row++, columnCount, deps);
}

View file

@ -28,6 +28,7 @@
#include <iomanip>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
@ -420,6 +421,40 @@ int handleInfo (std::string &outs)
table.addCell (row, 1, value);
}
// dependencies: blocked
row = table.addRow ();
table.addCell (row, 0, "This task blocked by");
if (task->has ("depends"))
{
std::string depends = task->get ("depends");
const std::vector <Task>& rpending = context.tdb.getAllPending ();
std::stringstream blocked;
std::vector <Task>::const_iterator it;
for (it = rpending.begin (); it != rpending.end (); ++it)
if (depends.find (it->get ("uuid")) != std::string::npos)
blocked << it->id << " " << it->get ("description") << "\n";
table.addCell (row, 1, blocked.str ());
}
// dependencies: blocking
{
row = table.addRow ();
table.addCell (row, 0, "This task is blocking");
std::string uuid = task->get ("uuid");
const std::vector <Task>& rpending = context.tdb.getAllPending ();
std::stringstream blocked;
std::vector <Task>::const_iterator it;
for (it = rpending.begin (); it != rpending.end (); ++it)
if (it->get ("depends").find (uuid) != std::string::npos)
blocked << it->id << " " << it->get ("description") << "\n";
table.addCell (row, 1, blocked.str ());
}
if (task->getStatus () == Task::recurring ||
task->has ("parent"))
{