Make tasks affect statistics of super-projects
This commit is contained in:
committed by
Paul Beckingham
parent
ffd6465661
commit
48be6986c2
@@ -1,5 +1,7 @@
|
||||
2.4.2 () -
|
||||
|
||||
- TW-41 Tasks in subprojects are not counted in project completion (thanks
|
||||
to Renato Alves).
|
||||
- TW-1450 Projects command should trigger running garbage collector (thanks to
|
||||
Tomas Babej).
|
||||
- TW-1535 move default listing-break from list to ls (thanks to David Patrick).
|
||||
|
||||
@@ -92,8 +92,16 @@ int CmdProjects::execute (std::string& output)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Increase the count for the project the task belongs to and all
|
||||
// its super-projects
|
||||
project = task->get ("project");
|
||||
unique[project] += 1;
|
||||
|
||||
std::vector <std::string> projects = extractParents (project);
|
||||
projects.push_back (project);
|
||||
|
||||
std::vector <std::string>::const_iterator parent;
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
unique[*parent] += 1;
|
||||
|
||||
if (project == "")
|
||||
no_project = true;
|
||||
|
||||
@@ -92,27 +92,34 @@ int CmdSummary::execute (std::string& output)
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
std::string project = task->get ("project");
|
||||
++counter[project];
|
||||
std::vector <std::string> projects = extractParents (project);
|
||||
projects.push_back (project);
|
||||
|
||||
std::vector <std::string>::const_iterator parent;
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
++counter[*parent];
|
||||
|
||||
if (task->getStatus () == Task::pending ||
|
||||
task->getStatus () == Task::waiting)
|
||||
{
|
||||
++countPending[project];
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
{
|
||||
++countPending[*parent];
|
||||
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
if (entry)
|
||||
sumEntry[project] = sumEntry[project] + (double) (now - entry);
|
||||
}
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
if (entry)
|
||||
sumEntry[*parent] = sumEntry[*parent] + (double) (now - entry);
|
||||
}
|
||||
|
||||
else if (task->getStatus () == Task::completed)
|
||||
{
|
||||
++countCompleted[project];
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
{
|
||||
++countCompleted[*parent];
|
||||
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
time_t end = strtol (task->get ("end").c_str (), NULL, 10);
|
||||
if (entry && end)
|
||||
sumEntry[project] = sumEntry[project] + (double) (end - entry);
|
||||
}
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
time_t end = strtol (task->get ("end").c_str (), NULL, 10);
|
||||
if (entry && end)
|
||||
sumEntry[*parent] = sumEntry[*parent] + (double) (end - entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user