Next Report

- Removed all traces of the old next report.
- Removed rc.next support.
This commit is contained in:
Paul Beckingham 2011-05-08 19:27:29 -04:00
parent 5da435e70d
commit b4fba5b08d
7 changed files with 13 additions and 209 deletions

View file

@ -1912,193 +1912,6 @@ int handleReportStats (std::string& outs)
return rc;
}
////////////////////////////////////////////////////////////////////////////////
void gatherNextTasks (std::vector <Task>& tasks)
{
// For counting tasks by project.
std::map <std::string, int> countByProject;
std::map <int, bool> matching;
std::vector <Task> filtered;
Date now;
// How many items per project? Default 2.
int limit = context.config.getInteger ("next");
// due:< 1wk, pri:*
std::vector <Task>::iterator task;
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (task->has ("due"))
{
Date d (atoi (task->get ("due").c_str ()));
if (d < now + (7 * 24 * 60 * 60)) // if due:< 1wk
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
}
// blocking, not blocked
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (dependencyIsBlocking (*task) &&
! dependencyIsBlocked (*task))
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
// due:*, pri:H
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (task->has ("due"))
{
std::string priority = task->get ("priority");
if (priority == "H")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
}
// pri:H
for (task = tasks.begin (); task != tasks.end (); ++task)
{
std::string priority = task->get ("priority");
if (priority == "H")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
// due:*, pri:M
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (task->has ("due"))
{
std::string priority = task->get ("priority");
if (priority == "M")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
}
// pri:M
for (task = tasks.begin (); task != tasks.end (); ++task)
{
std::string priority = task->get ("priority");
if (priority == "M")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
// due:*, pri:L
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (task->has ("due"))
{
std::string priority = task->get ("priority");
if (priority == "L")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
}
// pri:L
for (task = tasks.begin (); task != tasks.end (); ++task)
{
std::string priority = task->get ("priority");
if (priority == "L")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
// due:, pri:
for (task = tasks.begin (); task != tasks.end (); ++task)
{
if (task->has ("due"))
{
std::string priority = task->get ("priority");
if (priority == "")
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
}
}
// Filler.
for (task = tasks.begin (); task != tasks.end (); ++task)
{
std::string project = task->get ("project");
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
{
++countByProject[project];
matching[task->id] = true;
filtered.push_back (*task);
}
}
tasks = filtered;
}
///////////////////////////////////////////////////////////////////////////////
std::string getFullDescription (Task& task, const std::string& report)
{