From d68b86fe569a534ea62adec5772b1046ca32eda8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 1 Jul 2009 21:04:03 -0400 Subject: [PATCH] Enhancement - projects - Added priority subtotals to projects report. --- ChangeLog | 1 + src/command.cpp | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 446e7c8c0..f182c10ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,7 @@ + If task is renamed to "cal", or there is a symlink to task called "cal", then task can act as a replacement for the Unix "cal" command. + The "tags" report now shows the tag usage count. + + The "projects" report now shows totals by project and priority. Add: att mods diff --git a/src/command.cpp b/src/command.cpp index 1d596ff4a..3b8bb4577 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -119,8 +119,24 @@ std::string handleProjects () // Scan all the tasks for their project name, building a map using project // names as keys. std::map unique; + std::map high; + std::map medium; + std::map low; + std::map none; + std::string project; + std::string priority; foreach (t, tasks) - unique[t->get ("project")] += 1; + { + project = t->get ("project"); + priority = t->get ("priority"); + + unique[project] += 1; + + if (priority == "H") high[project] += 1; + else if (priority == "M") medium[project] += 1; + else if (priority == "L") low[project] += 1; + else none[project] += 1; + } if (unique.size ()) { @@ -128,21 +144,37 @@ std::string handleProjects () Table table; table.addColumn ("Project"); table.addColumn ("Tasks"); + table.addColumn ("Pri:None"); + table.addColumn ("Pri:L"); + table.addColumn ("Pri:M"); + table.addColumn ("Pri:H"); if (context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) { table.setColumnUnderline (0); table.setColumnUnderline (1); + table.setColumnUnderline (2); + table.setColumnUnderline (3); + table.setColumnUnderline (4); + table.setColumnUnderline (5); } table.setColumnJustification (1, Table::right); + table.setColumnJustification (2, Table::right); + table.setColumnJustification (3, Table::right); + table.setColumnJustification (4, Table::right); + table.setColumnJustification (5, Table::right); foreach (i, unique) { int row = table.addRow (); table.addCell (row, 0, i->first); table.addCell (row, 1, i->second); + table.addCell (row, 2, none[i->first]); + table.addCell (row, 3, low[i->first]); + table.addCell (row, 4, medium[i->first]); + table.addCell (row, 5, high[i->first]); } out << optionalBlankLine ()