mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug Fix - summary report
- Fixed bug in summary report where recently completed (and therefore not yet in the completed.data file) tasks were not included in the report.
This commit is contained in:
parent
df82fade2c
commit
e33a918c24
3 changed files with 34 additions and 48 deletions
|
@ -40,6 +40,8 @@
|
||||||
quotes, and limits output to pending tasks.
|
quotes, and limits output to pending tasks.
|
||||||
+ Task no longer includes deleted tasks in the summary report (thanks to
|
+ Task no longer includes deleted tasks in the summary report (thanks to
|
||||||
Benjamin Tegarden).
|
Benjamin Tegarden).
|
||||||
|
+ Fixed bug that prevented the summary report from properly reporting
|
||||||
|
recently completed tasks.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,8 @@
|
||||||
quotes, and limits output to pending tasks.
|
quotes, and limits output to pending tasks.
|
||||||
<li>Task no longer includes deleted tasks in the summary report (thanks to
|
<li>Task no longer includes deleted tasks in the summary report (thanks to
|
||||||
Benjamin Tegarden).
|
Benjamin Tegarden).
|
||||||
|
<li>Fixed bug that prevented the summary report from properly reporting
|
||||||
|
recently completed tasks.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -432,33 +432,23 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Project Tasks Avg Age Status
|
// Project Remaining Avg Age Complete 0% 100%
|
||||||
// A 12 13d XXXXXXXX------
|
// A 12 13d 55% XXXXXXXXXXXXX-----------
|
||||||
// B 109 3d 12h XX------------
|
// B 109 3d 12h 10% XXX---------------------
|
||||||
std::string handleReportSummary (TDB& tdb, T& task, Config& conf)
|
std::string handleReportSummary (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
// Generate unique list of project names.
|
std::vector <T> tasks;
|
||||||
std::map <std::string, bool> allProjects;
|
tdb.allT (tasks);
|
||||||
std::vector <T> pending;
|
handleRecurrence (tdb, tasks);
|
||||||
tdb.allPendingT (pending);
|
filter (tasks, task);
|
||||||
handleRecurrence (tdb, pending);
|
|
||||||
filter (pending, task);
|
|
||||||
for (unsigned int i = 0; i < pending.size (); ++i)
|
|
||||||
{
|
|
||||||
T task (pending[i]);
|
|
||||||
allProjects[task.getAttribute ("project")] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector <T> completed;
|
// Generate unique list of project names from all pending tasks.
|
||||||
tdb.allCompletedT (completed);
|
std::map <std::string, bool> allProjects;
|
||||||
filter (completed, task);
|
foreach (t, tasks)
|
||||||
for (unsigned int i = 0; i < completed.size (); ++i)
|
if (t->getStatus () == T::pending)
|
||||||
{
|
allProjects[t->getAttribute ("project")] = false;
|
||||||
T task (completed[i]);
|
|
||||||
allProjects[task.getAttribute ("project")] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize counts, sum.
|
// Initialize counts, sum.
|
||||||
std::map <std::string, int> countPending;
|
std::map <std::string, int> countPending;
|
||||||
|
@ -467,6 +457,7 @@ std::string handleReportSummary (TDB& tdb, T& task, Config& conf)
|
||||||
std::map <std::string, int> counter;
|
std::map <std::string, int> counter;
|
||||||
time_t now = time (NULL);
|
time_t now = time (NULL);
|
||||||
|
|
||||||
|
// Initialize counters.
|
||||||
foreach (i, allProjects)
|
foreach (i, allProjects)
|
||||||
{
|
{
|
||||||
countPending [i->first] = 0;
|
countPending [i->first] = 0;
|
||||||
|
@ -475,38 +466,29 @@ std::string handleReportSummary (TDB& tdb, T& task, Config& conf)
|
||||||
counter [i->first] = 0;
|
counter [i->first] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the pending tasks.
|
// Count the various tasks.
|
||||||
for (unsigned int i = 0; i < pending.size (); ++i)
|
foreach (t, tasks)
|
||||||
{
|
{
|
||||||
T task (pending[i]);
|
std::string project = t->getAttribute ("project");
|
||||||
std::string project = task.getAttribute ("project");
|
++counter[project];
|
||||||
if (task.getStatus () == T::pending)
|
|
||||||
|
if (t->getStatus () == T::pending)
|
||||||
|
{
|
||||||
++countPending[project];
|
++countPending[project];
|
||||||
|
|
||||||
time_t entry = ::atoi (task.getAttribute ("entry").c_str ());
|
time_t entry = ::atoi (t->getAttribute ("entry").c_str ());
|
||||||
if (entry)
|
if (entry)
|
||||||
{
|
sumEntry[project] = sumEntry[project] + (double) (now - entry);
|
||||||
sumEntry[project] = sumEntry[project] + (double) (now - entry);
|
|
||||||
++counter[project];
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Count the completed tasks.
|
else if (t->getStatus () == T::completed)
|
||||||
for (unsigned int i = 0; i < completed.size (); ++i)
|
|
||||||
{
|
|
||||||
T task (completed[i]);
|
|
||||||
std::string project = task.getAttribute ("project");
|
|
||||||
if (task.getStatus () == T::deleted)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
++countCompleted[project];
|
|
||||||
|
|
||||||
time_t entry = ::atoi (task.getAttribute ("entry").c_str ());
|
|
||||||
time_t end = ::atoi (task.getAttribute ("end").c_str ());
|
|
||||||
if (entry && end)
|
|
||||||
{
|
{
|
||||||
sumEntry[project] = sumEntry[project] + (double) (end - entry);
|
++countCompleted[project];
|
||||||
++counter[project];
|
|
||||||
|
time_t entry = ::atoi (t->getAttribute ("entry").c_str ());
|
||||||
|
time_t end = ::atoi (task.getAttribute ("end").c_str ());
|
||||||
|
if (entry && end)
|
||||||
|
sumEntry[project] = sumEntry[project] + (double) (end - entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue