mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - projects
- Added priority subtotals to projects report.
This commit is contained in:
parent
edcb719d94
commit
d68b86fe56
2 changed files with 34 additions and 1 deletions
|
@ -40,6 +40,7 @@
|
||||||
+ If task is renamed to "cal", or there is a symlink to task called "cal",
|
+ 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.
|
then task can act as a replacement for the Unix "cal" command.
|
||||||
+ The "tags" report now shows the tag usage count.
|
+ The "tags" report now shows the tag usage count.
|
||||||
|
+ The "projects" report now shows totals by project and priority.
|
||||||
|
|
||||||
Add:
|
Add:
|
||||||
att mods
|
att mods
|
||||||
|
|
|
@ -119,8 +119,24 @@ std::string handleProjects ()
|
||||||
// Scan all the tasks for their project name, building a map using project
|
// Scan all the tasks for their project name, building a map using project
|
||||||
// names as keys.
|
// names as keys.
|
||||||
std::map <std::string, int> unique;
|
std::map <std::string, int> unique;
|
||||||
|
std::map <std::string, int> high;
|
||||||
|
std::map <std::string, int> medium;
|
||||||
|
std::map <std::string, int> low;
|
||||||
|
std::map <std::string, int> none;
|
||||||
|
std::string project;
|
||||||
|
std::string priority;
|
||||||
foreach (t, tasks)
|
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 ())
|
if (unique.size ())
|
||||||
{
|
{
|
||||||
|
@ -128,21 +144,37 @@ std::string handleProjects ()
|
||||||
Table table;
|
Table table;
|
||||||
table.addColumn ("Project");
|
table.addColumn ("Project");
|
||||||
table.addColumn ("Tasks");
|
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) ||
|
if (context.config.get ("color", true) ||
|
||||||
context.config.get (std::string ("_forcecolor"), false))
|
context.config.get (std::string ("_forcecolor"), false))
|
||||||
{
|
{
|
||||||
table.setColumnUnderline (0);
|
table.setColumnUnderline (0);
|
||||||
table.setColumnUnderline (1);
|
table.setColumnUnderline (1);
|
||||||
|
table.setColumnUnderline (2);
|
||||||
|
table.setColumnUnderline (3);
|
||||||
|
table.setColumnUnderline (4);
|
||||||
|
table.setColumnUnderline (5);
|
||||||
}
|
}
|
||||||
|
|
||||||
table.setColumnJustification (1, Table::right);
|
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)
|
foreach (i, unique)
|
||||||
{
|
{
|
||||||
int row = table.addRow ();
|
int row = table.addRow ();
|
||||||
table.addCell (row, 0, i->first);
|
table.addCell (row, 0, i->first);
|
||||||
table.addCell (row, 1, i->second);
|
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 ()
|
out << optionalBlankLine ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue