From 64cfc26ff3c3dd149f21fceec4fd90cc7dcca55b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 14 Mar 2009 12:04:25 -0400 Subject: [PATCH] Enhanced Stats Report - now reports number of unique tags (given filtering) - now reports number of unique projects (given filtering) --- src/report.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/report.cpp b/src/report.cpp index ff26b34c8..5820bd7c5 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -1699,6 +1699,8 @@ std::string handleReportStats (TDB& tdb, T& task, Config& conf) int recurringT = 0; float daysPending = 0.0; int descLength = 0; + std::map allTags; + std::map allProjects; std::vector ::iterator it; for (it = tasks.begin (); it != tasks.end (); ++it) @@ -1727,6 +1729,13 @@ std::string handleReportStats (TDB& tdb, T& task, Config& conf) std::vector tags; it->getTags (tags); if (tags.size ()) ++taggedT; + + foreach (t, tags) + allTags[*t] = 0; + + std::string project = it->getAttribute ("project"); + if (project != "") + allProjects[project] = 0; } out << "Pending " << pendingT << std::endl @@ -1764,6 +1773,9 @@ std::string handleReportStats (TDB& tdb, T& task, Config& conf) out << "Tasks tagged " << std::setprecision (3) << (100.0 * taggedT / totalT) << "%" << std::endl; } + out << "Unique tags " << allTags.size () << std::endl; + out << "Projects " << allProjects.size () << std::endl; + return out.str (); }