mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug Fix - #196
- Fixed bug that caused an unexpected number of tasks to be displayed by the next command.
This commit is contained in:
parent
f790d52f62
commit
4439c07516
1 changed files with 67 additions and 79 deletions
146
src/report.cpp
146
src/report.cpp
|
@ -1836,26 +1836,23 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
||||||
std::vector <Task> filtered;
|
std::vector <Task> filtered;
|
||||||
Date now;
|
Date now;
|
||||||
|
|
||||||
// How many items per project? Default 3.
|
// How many items per project? Default 2.
|
||||||
int limit = context.config.get ("next", 3);
|
int limit = context.config.get ("next", 2);
|
||||||
|
|
||||||
// due:< 1wk, pri:*
|
// due:< 1wk, pri:*
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->has ("due"))
|
||||||
{
|
{
|
||||||
if (task->has ("due"))
|
Date d (::atoi (task->get ("due").c_str ()));
|
||||||
|
if (d < now + (7 * 24 * 60 * 60)) // if due:< 1wk
|
||||||
{
|
{
|
||||||
Date d (::atoi (task->get ("due").c_str ()));
|
std::string project = task->get ("project");
|
||||||
if (d < now + (7 * 24 * 60 * 60)) // if due:< 1wk
|
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
||||||
{
|
{
|
||||||
std::string project = task->get ("project");
|
++countByProject[project];
|
||||||
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
matching[task->id] = true;
|
||||||
{
|
filtered.push_back (*task);
|
||||||
++countByProject[project];
|
|
||||||
matching[task->id] = true;
|
|
||||||
filtered.push_back (*task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1864,29 +1861,7 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
||||||
// due:*, pri:H
|
// due:*, pri:H
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->has ("due"))
|
||||||
{
|
|
||||||
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
|
|
||||||
foreach (task, tasks)
|
|
||||||
{
|
|
||||||
if (task->getStatus () == Task::pending)
|
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
std::string priority = task->get ("priority");
|
||||||
if (priority == "H")
|
if (priority == "H")
|
||||||
|
@ -1902,32 +1877,26 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// due:*, pri:M
|
// pri:H
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
std::string priority = task->get ("priority");
|
||||||
|
if (priority == "H")
|
||||||
{
|
{
|
||||||
if (task->has ("due"))
|
std::string project = task->get ("project");
|
||||||
|
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
++countByProject[project];
|
||||||
if (priority == "M")
|
matching[task->id] = true;
|
||||||
{
|
filtered.push_back (*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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pri:M
|
// due:*, pri:M
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->has ("due"))
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
std::string priority = task->get ("priority");
|
||||||
if (priority == "M")
|
if (priority == "M")
|
||||||
|
@ -1943,32 +1912,26 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// due:*, pri:L
|
// pri:M
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
std::string priority = task->get ("priority");
|
||||||
|
if (priority == "M")
|
||||||
{
|
{
|
||||||
if (task->has ("due"))
|
std::string project = task->get ("project");
|
||||||
|
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
++countByProject[project];
|
||||||
if (priority == "L")
|
matching[task->id] = true;
|
||||||
{
|
filtered.push_back (*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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pri:L
|
// due:*, pri:L
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->has ("due"))
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
std::string priority = task->get ("priority");
|
||||||
if (priority == "L")
|
if (priority == "L")
|
||||||
|
@ -1984,28 +1947,53 @@ void gatherNextTasks (std::vector <Task>& tasks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pri:L
|
||||||
|
foreach (task, tasks)
|
||||||
|
{
|
||||||
|
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:
|
// due:, pri:
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if (task->getStatus () == Task::pending)
|
if (task->has ("due"))
|
||||||
{
|
{
|
||||||
if (task->has ("due"))
|
std::string priority = task->get ("priority");
|
||||||
|
if (priority == "")
|
||||||
{
|
{
|
||||||
std::string priority = task->get ("priority");
|
std::string project = task->get ("project");
|
||||||
if (priority == "")
|
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
||||||
{
|
{
|
||||||
std::string project = task->get ("project");
|
++countByProject[project];
|
||||||
if (countByProject[project] < limit && matching.find (task->id) == matching.end ())
|
matching[task->id] = true;
|
||||||
{
|
filtered.push_back (*task);
|
||||||
++countByProject[project];
|
|
||||||
matching[task->id] = true;
|
|
||||||
filtered.push_back (*task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filler.
|
||||||
|
foreach (task, tasks)
|
||||||
|
{
|
||||||
|
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;
|
tasks = filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue