From 54cf7e5471f2f9ee05c8efcfa598cc67b193214a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 12 Jul 2010 20:24:29 -0400 Subject: [PATCH] Dependencies - info - Added blocked and blocking tasks to the info report. --- src/custom.cpp | 2 +- src/report.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/custom.cpp b/src/custom.cpp index 0d70717d2..0129980b5 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -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); } diff --git a/src/report.cpp b/src/report.cpp index 4d370b11d..6000bd849 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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 & rpending = context.tdb.getAllPending (); + + std::stringstream blocked; + std::vector ::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 & rpending = context.tdb.getAllPending (); + + std::stringstream blocked; + std::vector ::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")) {