Statistics

- Added a backlog transaction count to the statistics.
This commit is contained in:
Paul Beckingham 2012-10-06 12:21:32 -04:00
parent 8d3e340819
commit 27df379f1d
2 changed files with 12 additions and 0 deletions

View file

@ -73,6 +73,13 @@ int CmdStatistics::execute (std::string& output)
if (*tx == "---")
++undoCount;
// Count the backlog transactions.
std::vector <std::string> backlogTxns = context.tdb2.backlog.get_lines ();
int backlogCount = 0;
for (tx = backlogTxns.begin (); tx != backlogTxns.end (); ++tx)
if ((*tx)[0] == '[')
++backlogCount;
// Get all the tasks.
std::vector <Task> all = context.tdb2.all_tasks ();
std::vector <Task> filtered;
@ -205,6 +212,10 @@ int CmdStatistics::execute (std::string& output)
view.set (row, 0, STRING_CMD_STATS_UNDO_TXNS);
view.set (row, 1, undoCount);
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_BACKLOG);
view.set (row, 1, backlogCount);
if (totalT)
{
row = view.addRow ();

View file

@ -249,6 +249,7 @@
#define STRING_CMD_STATS_PROJECTS "Projects"
#define STRING_CMD_STATS_DATA_SIZE "Data size"
#define STRING_CMD_STATS_UNDO_TXNS "Undo transactions"
#define STRING_CMD_STATS_BACKLOG "Sync backlog transactions"
#define STRING_CMD_STATS_TAGGED "Tasks tagged"
#define STRING_CMD_STATS_OLDEST "Oldest task"
#define STRING_CMD_STATS_NEWEST "Newest task"