- Fixed bug where "task projects" rendered an empty table instead of saying "no projects".

This commit is contained in:
Paul Beckingham
2008-05-27 21:03:27 -04:00
parent a42b8a89c3
commit abc9aa08ec
2 changed files with 29 additions and 23 deletions

View File

@@ -4,11 +4,11 @@
1.0.0 (?) 1.0.0 (?)
- New movie made, uploaded - New movie made, uploaded
- Bug: assertion fails on mobile for t v - Bug: assertion fails on mobile for t v
- Bug: configure.ac does not properly determine ncurses availability + Bug: configure.ac does not properly determine ncurses availability
- Bug: when run without arguments, task dumps core on Solaris 10 - Bug: when run without arguments, task dumps core on Solaris 10
- Bug: Cannot seem to use the percent character in a task description - Bug: Cannot seem to use the percent character in a task description
- Bug: New installation "task stats" reports newest task 12/31/1969 - Bug: New installation "task stats" reports newest task 12/31/1969
- Bug: New installation task projects displays header but no data - should short-circuit + Bug: New installation task projects displays header but no data - should short-circuit
+ Bug: incorrect color specification in sample .taskrc file + Bug: incorrect color specification in sample .taskrc file
------ reality ----------------------------------- ------ reality -----------------------------------

View File

@@ -307,29 +307,35 @@ void handleProjects (const TDB& tdb, T& task, Config& conf)
unique[task.getAttribute ("project")] += 1; unique[task.getAttribute ("project")] += 1;
} }
// Render a list of project names from the map. if (unique.size ())
Table table;
table.addColumn ("Project");
table.addColumn ("Tasks");
table.setColumnUnderline (0);
table.setColumnUnderline (1);
table.setColumnJustification (1, Table::right);
foreach (i, unique)
{ {
int row = table.addRow (); // Render a list of project names from the map.
table.addCell (row, 0, i->first); Table table;
table.addCell (row, 1, i->second); table.addColumn ("Project");
} table.addColumn ("Tasks");
std::cout << std::endl table.setColumnUnderline (0);
<< table.render () table.setColumnUnderline (1);
<< std::endl
<< unique.size () table.setColumnJustification (1, Table::right);
<< (unique.size () == 1 ? " project" : " projects")
<< std::endl; foreach (i, unique)
{
int row = table.addRow ();
table.addCell (row, 0, i->first);
table.addCell (row, 1, i->second);
}
std::cout << std::endl
<< table.render ()
<< std::endl
<< unique.size ()
<< (unique.size () == 1 ? " project" : " projects")
<< std::endl;
}
else
std::cout << "No projects."
<< std::endl;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////