Make TDB2.backlog non-public
The stats command gets this information from an API that will also work for TaskChampion. The sync command still accesses the field directly, as the command must be completely rewritten for TaskChampion.
This commit is contained in:
committed by
Tomas Babej
parent
d699ce8cba
commit
c8cfcec48b
@@ -63,18 +63,14 @@ int CmdStats::execute (std::string& output)
|
||||
std::string dateformat = Context::getContext ().config.get ("dateformat");
|
||||
|
||||
// Go get the file sizes.
|
||||
size_t dataSize = Context::getContext ().tdb2.pending._file.size ()
|
||||
+ Context::getContext ().tdb2.completed._file.size ()
|
||||
+ Context::getContext ().tdb2.undo._file.size ()
|
||||
+ Context::getContext ().tdb2.backlog._file.size ();
|
||||
size_t dataSize = Context::getContext ().tdb2.data_size ();
|
||||
|
||||
// Count the undo transactions.
|
||||
std::vector <std::string> undoTxns = Context::getContext ().tdb2.undo.get_lines ();
|
||||
int undoCount = std::count(undoTxns.begin(), undoTxns.end(), "---");
|
||||
|
||||
// Count the backlog transactions.
|
||||
std::vector <std::string> backlogTxns = Context::getContext ().tdb2.backlog.get_lines ();
|
||||
int backlogCount = std::count_if(backlogTxns.begin(), backlogTxns.end(), [](const auto& tx){ return tx.front() == '{'; });
|
||||
int numLocalChanges = Context::getContext ().tdb2.num_local_changes ();
|
||||
|
||||
// Get all the tasks.
|
||||
Filter filter;
|
||||
@@ -207,7 +203,7 @@ int CmdStats::execute (std::string& output)
|
||||
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, "Sync backlog transactions");
|
||||
view.set (row, 1, backlogCount);
|
||||
view.set (row, 1, numLocalChanges);
|
||||
|
||||
if (totalT)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user